[cfe-dev] lookup from AST
Chris Lattner
clattner at apple.com
Thu Oct 15 08:49:27 PDT 2009
On Oct 15, 2009, at 6:06 AM, Axel Naumann wrote:
> Hi,
>
> progress, but not enough:
>
> Axel Naumann wrote on 10/15/2009 10:58 AM:
>> Should I create an IdentifierTable and put that single name (and its
>> declaring contexts) that I want to look up in there? Or is there a
>> simpler way of creating a DeclarationName from a string?
>
> of course this is the wrong approach; I should first lex the string.
> But
> building a full blown preprocessor every time I need to lex a string
> like "nsp::class" looks a bit heavy. Is there a shortcut? Is it
> Preprocessor::CreateString()?
If you have an ASTContext, you should be able to get to the identifier
table it refers to. Based on that, you can use Table->get("foo") to
get a uniqued identifierinfo*.
-Chris
More information about the cfe-dev
mailing list