DECL_SOURCE_LINE of else

Ian Lance Taylor iant@google.com
Mon Oct 11 19:58:00 GMT 2010


Peter Jensen <skruedims@yahoo.dk> writes:

> I am creating a plugin which parses the generic tree and inserts a function call in a if/else clause.
> The function writes which lineno gets executed to stdout.
> I wish to get the line number for the if statement and for the else statement. (and not the body. eg ELSE_CLAUSE).
>
> My problem is that while I can get the line number for the  if condition (eg. DECL_SOURCE_LINE(if_cond)),
> is it also possible to get the precise line number for the 'else' label?

You mean the location of the "else" keyword in the source code?
Unfortunately that location is not currently recorded in GENERIC or
GIMPLE.  You can of course get the location of the first statement in
the else block.

Ian



More information about the Gcc mailing list