[cfe-dev] [Question] About getting the name of AST node from DynTypedNode

Saheel Godhane srgodhane at ucdavis.edu
Tue Feb 24 19:00:40 PST 2015


Hello!

I wanted to get the names of AST nodes while writing a checker, something
like "FunctionDecl", "ParenExpr", etc.

I tried this: my_dyn_typed_node.getNodeKind().asStringRef()

But this always returned Stmt or Decl, i.e. the name of the base type of
the AST node. How to get the derived name?

I looked up in ASTTypeTraits.cpp but I am a bit confused about the contents
of AllKindInfo. By the way, I am using a snapshot of Clang 3.6 which didn't
have DynTypedNode::getNodeKind(), which I defined myself just as it is
defined in the latest versions. Not sure if that is somehow linked to the
unexpectedness of the output.

Thanks,
Saheel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150224/003faee2/attachment.html>


More information about the cfe-dev mailing list