[cfe-dev] Detecting whether a Declarator is a function template

Manjunath Kudlur keveman at gmail.com
Thu May 10 15:46:09 PDT 2012

I have a ParsingDeclarator object during parsing, and I want to find out if
it is a function template before a Decl* is generated for the declarator.
As a first step, I used D.isDeclarationOfFunction() to make sure that the
declarator is a function. Then I make sure that TemplateInfo.TemplateParams
is not null. But these two checks does not catch the following case :

template<typename T>
struct foo {
  void bar(int);

The above two conditions are true for the 'bar' declarator. Even though bar
appears within a class template, bar itself is not a function template. How
do I detect this case? I suspect that the getDepth() function in
TemplateParameterList should be useful, but I am not able to figure out the
exact check I need to do. Any hints will be helpful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120510/d7b55217/attachment.html>

More information about the cfe-dev mailing list