[cfe-dev] Get EnumDecl from Sema
Reid Kleckner
rnk at google.com
Wed Apr 29 14:37:06 PDT 2015
IdentifierInfo's are just uniqued strings that track properties like
whether the identifer was every a macro or keyword, etc. The preprocessor
has an IdentifierTable and you can do something like
'PP.getIdentifierTable().get("MyEnum")' to get one.
On Wed, Apr 29, 2015 at 2:08 PM, Daniel Dilts <diltsman at gmail.com> wrote:
> How do I create the DeclarationName or DeclarationNameInfo to use
> Sema::LookupName? I know the name of the enum type, but I cannot see how
> to create one of those using a string literal. I keep running into
> IdentifierInfo which only has a default constructor.
>
> On Tue, Apr 28, 2015 at 1:17 PM, Reid Kleckner <rnk at google.com> wrote:
>
>> You can use Sema::LookupName to do arbitrary name lookup. If you know the
>> expression references the enum, you might be able to navigate the AST to
>> find it that way.
>>
>> On Tue, Apr 28, 2015 at 10:00 AM, Daniel Dilts <diltsman at gmail.com>
>> wrote:
>>
>>> I would like to get an EnumDecl in Sema::ActOnIdExpression. I know the
>>> name of the enumeration type. How would I go about finding it? I assume
>>> it is somewhere in the ASTContext, but I can't find it.
>>>
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150429/34b0ebca/attachment.html>
More information about the cfe-dev
mailing list