<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Did you look at my failing test-case that I attached earlier?
Specifically:<br>
<br>
...<br>
class Vis : public RecursiveASTVisitor<Vis> {<br>
public:<br>
Vis(SourceManager& sm_) : sm(sm_) {}<br>
<br>
bool VisitFunctionTemplateDecl(FunctionTemplateDecl *tf) {<br>
std::cout << "visiting template func decl" <<
std::endl; <br>
return true;<br>
}<br>
bool VisitFunctionDecl(FunctionDecl *f) {<br>
std::cout << "visiting func decl: " <<
f->getNameInfo().getAsString() << std::endl; <br>
return true;<br>
}<br>
<br>
SourceManager& sm;<br>
}; <br>
...<br>
<br>
Neither functions find h().<br>
<br>
<div class="moz-cite-prefix">On 11/29/2014 08:40 PM, James Dennett
wrote:<br>
</div>
<blockquote
cite="mid:CAKNGpgp+Rcs4vQmV4Se9tsFrsNCyGTaO2N84f0WJDGtYMf_EKg@mail.gmail.com"
type="cite">
<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"><<a moz-do-not-send="true"
href="mailto:jfeltz@gmail.com" target="_blank">jfeltz@gmail.com</a>></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't seem to traverse the following with either a
RecursiveASTVisitor or a AST Matcher converted to an
ASTConsumer:<br>
<br>
template<typename T> void h(T x) { .. }<br>
<br>
First some things I'd like to note:<br>
1) $ llvm-config --version<br>
3.5.0<br>
<br>
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:<br>
$ clang -Xclang -ast-dump -fsyntax-only file.cc<br>
..<br>
FunctionTemplateDecl 0x23e5330 <line:13:1,
line:15:1> line:13:27 h<br>
..<br>
<br>
3) I am not a C++ expert, and I am a libtooling newbie.<br>
<br>
I've attached the parsed subject (file.cc) and the code
I'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 moz-do-not-send="true" class=""
href="https://cs.corp.google.com/#piper///depot/google3/third_party/llvm/llvm/tools/clang/include/clang/AST/Decl.h&ct=xref_jump_to_def&cl=GROK&l=2013&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>
</blockquote>
<br>
</body>
</html>