[cfe-dev] help: from Stmt object to Decl
彩云追月
wuming_81 at 163.com
Wed Jan 28 15:17:33 PST 2015
>Message: 1
>Date: Wed, 28 Jan 2015 02:04:24 +0100
>From: mobi phil <mobi at mobiphil.com>
>To: ???? <wuming_81 at 163.com>
>Cc: clang-list <cfe-dev at cs.uiuc.edu>
>Subject: Re: [cfe-dev] help: from Stmt object to Decl
>Message-ID:
> <CAGMoNKt2tGEjtycqKPd=cAyMLJXDfZXw=xwRCk6csM5YrsnhPQ at mail.gmail.com>
>Content-Type: text/plain; charset="utf-8"
>
>>
>> i.e how could I get the FunctionDecl object ?
>>
>
>though not sure exactly what you would like to do, and what do you mean you
>get the BinaryOperator here is a hint based on my "poor" experience. There
>are to ways to find objects in AST:
>-> using the visitor pattern
>-> dynamic matchers. My favorite is to use the one based on matcher
>strings.
>
>For this one you may use the clang-query tool or the tool I wrote cmatch (
>https://github.com/mobiphil/cmatch), or look in the code how they query the
>AST tree for certain types of nodes.
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150129/a6f0120b/attachment.html>
More information about the cfe-dev
mailing list