[cfe-dev] lookup from AST

Douglas Gregor dgregor at apple.com
Wed Oct 14 08:07:07 PDT 2009


On Oct 14, 2009, at 7:09 AM, Axel Naumann wrote:

> Hi,
>
> the consumer is great when I want to create a map / copy of the AST
> data. But I really would like to keep the AST data inside the
> ASTContext, and only query it, e.g. starting form a type name. If I
> understand the cunsumer correctly I would have to consume the AST and
> then walk my way down the scopes, for every lookup - even though  
> that's
> already (much better :-) implemented in Sema...


DeclContext::lookup will perform name lookup into a specific context  
(class, namespace, etc.), but it only looks in that context---it  
doesn't perform full C++ qualified name lookup.

The real name-lookup routines live in Sema, but there are multiple  
clients that could benefit from moving these routines into the AST.  
For qualified name lookup, it's "just" a bunch of refactoring. For  
unqualified name lookup, it's a bit tougher, since we don't actually  
maintain Scope information in the AST.

	- Doug



More information about the cfe-dev mailing list