[cfe-dev] lookup of a variable

Douglas Gregor dgregor at apple.com
Wed Sep 1 13:16:07 PDT 2010


On Sep 1, 2010, at 1:13 PM, Jan Bierbaum wrote:

> Douglas Gregor meinte am 01.09.2010 16:18:
>>> Given the qualified identifier of a variable (as a pure string like
>>> "A::B::foo"), an ASTContext and a Sema how can I
>> 
>> If you're actually coming from a string, you should consider watching
>> what the parser does when parsing A::B::foo as an id-expression.
> 
> I did that, but ran into a dead end soon. The parser starts with a
> 'ParsingDeclSpec' which I cannot create because I'm missing a reference
> to the parser. From there on I cannot replicate any of the actions the
> parser does. Perhaps I should have mentioned earlier that I'm working
> from inside a plugin's 'SemaConsumer'...
> 
> The core of my problem is that I need some way to hand craft an
> 'IdentifierInfo' without the parser. Is that possible at all?

IdentifierInfo's are created by IdentifierTable::get(). The ASTContext has a reference to an IdentifierTable that you can use.

	- Doug





More information about the cfe-dev mailing list