[cfe-dev] Function Arg Type not expected

Daniel Dilts via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 15 17:21:22 PDT 2016


I am writing a tool using the 3.8.0 source code.  My ASTMatcher is
callExpr().bind("callExpr");  I am getting the type of the first argument
with auto type = callExpr->getArg(i)->IgnoreImplicit()->getType();

Given this code:

template <typename>
struct S{};

void Func2()
{
 S<int> s;
 Func(s);
}

If Func is declared as either of these, then
type->getAs<TemplateSpecializationType>() returns a non-null value and
type.getAsString() returns "S<int>":

void Func(...);

template <typename T>
void Func(const T&);

If Func is declared as this, then type->getAs<TemplateSpecializationType>()
returns null and type.getAsString() returns "struct S<int>":

template <typename T>
void Func(T);



I would expect all three to return a non-null value and the same result
from getAsString.  Why do these differ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160615/c4647d7d/attachment.html>


More information about the cfe-dev mailing list