<div dir="ltr">Does getUnderlyingType work for you?<div><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__clang.llvm.org_doxygen_classclang-5F1-5F1TypedefNameDecl.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=Tb-XvHrYmoQGvlVy1_7YM79HudLETv33O6g94SsUVCg&s=2G1wEl7yFhJbUKKmy-FvUn4bcOHRJwTLd26BH8MiiKo&e=">http://clang.llvm.org/doxygen/classclang_1_1TypedefNameDecl.html</a> </div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 13, 2015 at 6:33 PM Frank Redeker <<a href="mailto:f.redeker@razorcat.de">f.redeker@razorcat.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
<br>
not sure if this is the right place to ask my question.<br>
<br>
I'm writing an analyzer tool using the clang ASTConsumer. When I'm<br>
analyzing the following piece I don't know how to get back from the<br>
TypedefDeclto the unterlying EnumDecl<br>
<br>
typedef enum {<br>
        Illegal = -1,<br>
        Init = 0,<br>
        Run,<br>
        Stop<br>
} T_ENUM;<br>
<br>
<br>
In my ast consumer<br>
<br>
void IDB_ASTConsumer::handleDecl (Decl * decl) {<br>
.<br>
.<br>
else if (EnumDecl * enumDecl = llvm::dyn_cast<EnumDecl>(decl)) {<br>
   enumDecl->dump();<br>
EnumDecl 0x1da43360<br>
<T:\Projects\3.3\CLANG\source\001-005\001-One-Dimension.c:25:9,<br>
line:30:1> line:25:9<br>
|-EnumConstantDecl 0x1da433f0 <line:26:2, col:9> col:2 Init 'T_ENUM'<br>
| `-IntegerLiteral 0x1da433d0 <col:9> 'int' 0<br>
|-EnumConstantDecl 0x1da43460 <line:27:2, col:13> col:2 Illegal 'T_ENUM'<br>
| `-UnaryOperator 0x1da43448 <col:12, col:13> 'int' prefix '-'<br>
|   `-IntegerLiteral 0x1da43430 <col:13> 'int' 1<br>
|-EnumConstantDecl 0x1da434a0 <line:28:2> col:2 Run 'T_ENUM'<br>
`-EnumConstantDecl 0x1da434e0 <line:29:2> col:2 Stop 'T_ENUM'<br>
}<br>
else if (TypedefDecl * typedefDecl = llvm::dyn_cast<TypedefDecl>(decl)) {<br>
   typedefDecl->getTypeForDecl()->dump();<br>
NULL TYPE<br>
<br>
   typedefDecl->dump();<br>
TypedefDecl 0x1da43550<br>
<T:\Projects\3.3\CLANG\source\001-005\001-One-Dimension.c:25:1,<br>
line:30:3> col:3 T_ENUM 'enum T_ENUM':'T_ENUM'<br>
}<br>
<br>
Is there a way to access the EnumDecl from the TypdefDecl<br>
<br>
<br>
Thanks<br>
Frank<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>