[cfe-dev] Start of source range for Decl nodes.

Stefan Seefeld stefan at seefeld.name
Fri Mar 4 08:06:43 PST 2011


On 2011-03-04 10:30, Douglas Gregor wrote:
> On Mar 1, 2011, at 10:44 AM, Enea Zaffanella wrote:
>
>> Assuming that the goal of obtaining precise source location info should
>> be achieved by all means, now the question is: which is best place where
>> this additional source location (the start of the range) for the Decl
>> hierarchy should be stored?
>> Would it be OK to store them at the top of the hierarchy?
>> Are there better places?
> I'd rather that we only add this information to those AST nodes that need it.
>
> Also, the source range for a DeclaratorDecl (and anything else that stares with declaration specifiers) gets messy when there are multiple declarations, e.g.,
>
>    static struct Point { int x, y; } p1, *p2, get_point(int x, int y);
>
> Who claims the "static" keyword? Point? p1? Everyone?
>
> If this occurred inside a DeclStmt, we'd have a DeclGroup to help us sort through this. At namespace scope, we don't have the equivalent notion.

Doug,

you may remember my request for something similar, via libclang. To be 
able to extract inline documentation from source code, I also need to 
find the source range not only for a particular declarator, but also the 
entire declaration. Right now there is no way to get to that via 
libclang, as declarations aren't represented by cursors.

Thanks,
         Stefan


-- 

       ...ich hab' noch einen Koffer in Berlin...




More information about the cfe-dev mailing list