[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] unable to traverse FunctionTemplateDecl (right name?) with either RecursiveASTVisitor 
From:       James Dennett <james.dennett () gmail ! com>
Date:       2014-11-30 3:40:55
Message-ID: CAKNGpgp+Rcs4vQmV4Se9tsFrsNCyGTaO2N84f0WJDGtYMf_EKg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sat, Nov 29, 2014 at 2:48 PM, John P. Feltz <jfeltz@gmail.com> wrote:

> Hi,
> 
> I can't seem to traverse the following with either a RecursiveASTVisitor
> or a AST Matcher converted to an ASTConsumer:
> 
> template<typename T> void h(T x) { .. }
> 
> First some things I'd like to note:
> 1) $ llvm-config --version
> 3.5.0
> 
> 2) 'clang' actually does find the template function, so I suspect I'm
> doing something wrong in either the visitor and matcher, or in the compiler
> setup:
> $ clang -Xclang -ast-dump -fsyntax-only file.cc
> ..
> FunctionTemplateDecl 0x23e5330 <line:13:1, line:15:1> line:13:27 h
> ..
> 
> 3) I am not a C++ expert, and I am a libtooling newbie.
> 
> I've attached the parsed subject (file.cc) and the code I'm using to build
> and run the test-case.
> 
> 
You might try visiting the FunctionDecl and then calling
getDescribedFunctionTemplate
<https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/tools/clang/i \
nclude/clang/AST/Decl.h&ct=xref_jump_to_def&cl=GROK&l=2013&gsn=getDescribedFunctionTemplate>
 on
it to get the associated FunctionTemplateDecl.

-- James


[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Nov 29, 2014 \
at 2:48 PM, John P. Feltz <span dir="ltr">&lt;<a href="mailto:jfeltz@gmail.com" \
target="_blank">jfeltz@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi,<br>
 <br>
I can&#39;t seem to traverse the following with either a RecursiveASTVisitor or a AST \
Matcher converted to an ASTConsumer:<br> <br>
template&lt;typename T&gt; void h(T x) { .. }<br>
<br>
First some things I&#39;d like to note:<br>
1) $ llvm-config --version<br>
3.5.0<br>
<br>
2) &#39;clang&#39; actually does find the template function, so I suspect I&#39;m \
doing something wrong in either the visitor and matcher, or in the compiler \
setup:<br> $ clang -Xclang -ast-dump -fsyntax-only file.cc<br>
..<br>
FunctionTemplateDecl 0x23e5330 &lt;line:13:1, line:15:1&gt; line:13:27 h<br>
..<br>
<br>
3) I am not a C++ expert, and I am a libtooling newbie.<br>
<br>
I&#39;ve attached the parsed subject (file.cc) and the code I&#39;m using to build \
and run the test-case.<br> <br></blockquote><div><br></div><div>You might try \
visiting the FunctionDecl and then calling  <a class="" \
href="https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/tools/cl \
ang/include/clang/AST/Decl.h&amp;ct=xref_jump_to_def&amp;cl=GROK&amp;l=2013&amp;gsn=getDescribedFunctionTemplate" \
style="text-decoration:none;color:rgb(85,26,139);font-family:monospace;font-size:medium;line-height:16.25px;white-space:pre">getDescribedFunctionTemplate</a> \
on it to get the associated FunctionTemplateDecl.<br></div><div><br></div><div>-- \
James</div><div><br></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