[cfe-dev] help: from Stmt object to Decl

mobi phil mobi at mobiphil.com
Wed Jan 28 15:29:29 PST 2015


>
> mobi phil, Thanks ! I will use VisitStmt.
>
> But I have another question:
>
>    How to get namespace name of a  function ?
>
> if this function is CXXMethodDecl, I  use CXXRecordDecl to get a NamespaceDecl  object, then I will get the namespace name.
>
> if this function is a global function, I do not know howto.
>
>
do not know at the moment, but general advice: play with the dynamic
matchers and the completion mechanism. That is how I learned a lot about
the relationship between objects (nodes) in the AST. There is not too much
documentation, but the clang-query or cmatch will tell you a lot about the
relationship between AST nodes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150129/1aa5aee9/attachment.html>


More information about the cfe-dev mailing list