[Soot-list] ***SPAM*** Difference between LineNumberTag and SourceLnPosTag

fengguang fggong at 126.com
Tue May 1 05:04:14 EDT 2012


Hi  SOOT-LIST,

I want to get a Unit’s line number in the source java file. I tried to
implement like this:

1)      Options.v().set_keep_line_number(true);

              PhaseOptions.v().setPhaseOption("tag.ln","on");

          ……………………………

                Stmt _stmt=(Stmt)_stmts.next();

                            Unit _lineunit=(Unit)_stmt;

                            int _linenum=-1;                 

                            LineNumberTag
_lntag=(LineNumberTag)_lineunit.getTag("LineNumberTag");


                                    if(_lntag!=null){

                                       _linenum=_lntag.getLineNumber(); 

                                }

Ps:answer is wrong.

 

2)       Options.v().set_keep_line_number(true);

              PhaseOptions.v().setPhaseOption("tag.ln","on");

           ……………………………

                Stmt _stmt=(Stmt)_stmts.next();

                            Unit _lineunit=(Unit)_stmt;

                            int _linenum=-1;                 

                            SourceLnPosTag  _lntag=( SourceLnPosTag
)_lineunit.getTag("SourceLnPosTag ");                       

                                    if(_lntag!=null){

                                       _linenum=_lntag.startLn(); 

                                }

 

Ps:answer is right.

 

I want to know the difference between LineNumberTag and SourceLnPosTag and
why 1) is wrong….

Thanks any help.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.cs.mcgill.ca/pipermail/soot-list/attachments/20120501/9e7a3072/attachment.html 


More information about the Soot-list mailing list