[cfe-dev] unable to traverse FunctionTemplateDecl (right name?) with either RecursiveASTVisitor or Matcher

James Dennett james.dennett at gmail.com
Sat Nov 29 19:40:55 PST 2014


On Sat, Nov 29, 2014 at 2:48 PM, John P. Feltz <jfeltz at 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/include/clang/AST/Decl.h&ct=xref_jump_to_def&cl=GROK&l=2013&gsn=getDescribedFunctionTemplate>
on
it to get the associated FunctionTemplateDecl.

-- James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20141129/124d37e6/attachment.html>


More information about the cfe-dev mailing list