[cfe-dev] Stmt.getLocEnd()

Manuel Klimek klimek at google.com
Fri Feb 1 01:02:10 PST 2013


On Fri, Feb 1, 2013 at 9:25 AM, Antoine Trouve <trouve at isit.or.jp> wrote:

> Hi everybody,
>
> I am now using LibTooling with the RefactoringTool to add some comments in
> some C codes.
>
> I am now trying to add comments after a given statement (the body of a for
> to say the truth);
> in order to detect the location of the end of a statement I use
> "Stmt.getLocEnd()", but I seems that its output is often inaccurate.
>
> Here are two examples, if I insert "/* HERE */" at the end location:
>
>         for(i=0; i<N/2; i++) res +=mand(i,N/4/* HERE */);
>         for(i=0; i<mand(N,N); i++) res /* HERE */++;
>
> I would expect the following output:
>
>         for(i=0; i<N/2; i++) res +=mand(i,N/4);/* HERE */
>         for(i=0; i<mand(N,N); i++) res ++;/* HERE */
>
> It looks like a bug. Am I right or did I miss something ?
>
> I found a previous recent discussion about this matter (
> http://clang-developers.42468.n3.nabble.com/Statements-that-end-with-td4028311.html),
> but It looks like nothing has been done.
>

Yes, this is a known issue, and as far as I'm aware nothing has been done.
We're usually working around this by looking for the next ';' token.

I guess it's the good old "patches welcome" answer - or wait until it
becomes important enough for somebody else to solve.

Cheers,
/Manuel


>
> - Antoine
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130201/ac598e93/attachment.html>


More information about the cfe-dev mailing list