[cfe-dev] Statement End Location

Sebastian Redl sebastian.redl at getdesigned.at
Mon Nov 19 07:59:29 PST 2012

On 19.11.2012, at 06:36, madil90 wrote:

> Hi,
>   I want to find the end location of a statement. Unfortunately, clang
> gives the end location at an undesired place. e.g.
> return a;    // I want the end to be after ";"
> return a;    // while clang gives the end after "return"
> a = a + 2;    // I need end at ";", but clang gives end at "a=a"
>    This is similar for other statements. Is there any reasons for not
> including the final portion in the Statement. If yes, how can I get the end
> location at ";" rather than before. Thxn for your help.

That sounds like bugs in the AST node creation. The correct fix is probably in the parser, where the end locations for statements must be passed to Sema.


More information about the cfe-dev mailing list