How to get function declaration source file/line from definition?

Manuel López-Ibáñez
Fri Jan 22 16:53:00 GMT 2016

On 22/01/16 03:00, crasypantz wrote:
> My understanding is with a gcc plugin, by the time I get to analyze the AST
> the entire source file has been parsed. Therefore, I don't understand how I
> could access the old declaration before the merge (maybe that was your final
> answer). Also, the example you show has a different signature between
> declaration and definition where the former returns 'void' and the latter
> returns 'int'. Or when you say 'set a breakpoint', are you using the
> different return value to effectively accomplish this? Sorry if you are
> speaking high level and I'm not keeping up- please bear with me :)

What I mean is that if you debug gcc while running that testcase and put a 
breakpoint at the point of gcc's code where that error is given, you can find 
out when the merging occurs and what happens to the old tree node.

Not sure if plugins can at the moment access that info, but you can always 
propose patches to enable that. The plugin API is driven by its users, there is 
no grand design.



More information about the Gcc-help mailing list