[cfe-dev] How to find out name of variable of a given DeclStmt
Jordan Rose
jordan_rose at apple.com
Fri Dec 21 09:15:36 PST 2012
Hi, Fritz. A DeclStmt can have more than one Decl in it...
int a, *b, c = 3;
...so you'll have to iterate over the Decls within it using decl_begin() and decl_end(). And since not all Decls have names, you'll then have to dyn_cast* each one to a NamedDecl before printing any names.
*It's possible that all Decls found in a DeclStmt will have names, in which case you can just use the asserting 'cast' instead of 'dyn_cast'.
Hope that helps,
Jordan
On Dec 21, 2012, at 2:48 , Fritz Franz <antonmaier40 at gmail.com> wrote:
> Hi, please could anybody help me?
>
> I have a DeclStmt and I would like to find out the name of the variable that
> is declared.
>
> Thanks,
> best regards
> Fritz Franz
>
>
>
> --
> View this message in context: http://clang-developers.42468.n3.nabble.com/How-to-find-out-name-of-variable-of-a-given-DeclStmt-tp4029123.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> 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/20121221/8ea359a1/attachment.html>
More information about the cfe-dev
mailing list