[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: Re: [cfe-dev] help: from Stmt object to Decl
From: mobi phil <mobi () mobiphil ! com>
Date: 2015-01-28 23:29:29
Message-ID: CAGMoNKuXps-NVQUhBV-ZGNiqm3A0D2bjnh_UL3cvBV+1zvpK1w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
>
> 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.
[Attachment #5 (text/html)]
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div \
style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><pre><div><span \
style="line-height:19.0399990081787px;font-family:Arial">mobi phil, Thanks ! I will \
use VisitStmt.</span><br></div><div><pre style="line-height:19.0399990081787px">But I \
have another question:</pre><pre style="line-height:19.0399990081787px"> How to \
get namespace name of a function ?</pre><pre \
style="line-height:19.0399990081787px">if this function is CXXMethodDecl, I use \
CXXRecordDecl to get a <span style="line-height:19.0399990081787px">NamespaceDecl \
object, then I will get the namespace name.</span></pre><pre \
style="line-height:19.0399990081787px"><span \
style="line-height:19.0399990081787px">if this function is a global function, I do \
not know howto.</span></pre></div></pre></div></blockquote><div><br></div><div>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. </div></div> \
</div></div>
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic