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

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.

A polite bump.

If not from DynTypedNode, is there some other general way to get the exact name of the AST node? Perhaps from ASTContext and a Stmt/Decl?

Regards,
Saheel.