<div dir="ltr">You are right that all it does have the implicit cast to const, but all three have an implicit cast to const that are notated as <NoOp>.  So, that doesn't appear to be what is causing my issues.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 15, 2016 at 7:29 PM, don hinton <span dir="ltr"><<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If you dump the ast, -Xclang -ast-dump -fsyntax-only, you'll see that when s is passed by value, an ImplicitCastExpr node is created for the implicit type conversion from "struct S<int>" to "const struct S<int>", and you are ignoring implicits,  <span style="font-size:12.8px">IgnoreImplicit():</span><div><div><br></div><div><div>    |-CallExpr 0x7fefab076990 <line:44:3, col:9> 'void'</div><div>    | |-ImplicitCastExpr 0x7fefab076978 <col:3> 'void (*)(struct S<int>)' <FunctionToPointerDecay></div><div>    | | `-DeclRefExpr 0x7fefab0768e8 <col:3> 'void (struct S<int>)' lvalue Function 0x7fefab0767e0 'Func' 'void (struct S<int>)' (FunctionTemplate 0x7fefab06e808 'Func')</div><div>    | `-CXXConstructExpr 0x7fefab076a28 <col:8> 'struct S<int>':'struct S<int>' 'void (const struct S<int> &) throw()'</div><div>    |   `-ImplicitCastExpr 0x7fefab0769c0 <col:8> 'const struct S<int>' lvalue <NoOp></div><div>    |     `-DeclRefExpr 0x7fefab0765b8 <col:8> 'S<int>':'struct S<int>' lvalue Var 0x7fefab06ee48 's' 'S<int>':'struct S<int>'</div></div><div><br></div><div>If you made s const instead, i.e., const S<int> s, then clang wouldn't need to implicitly convert it and you should see it.</div><div><br></div><div>hth...</div><div>don</div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Jun 15, 2016 at 5:21 PM, Daniel Dilts via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div>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();</div><div><br></div><div>Given this code:</div><div><br></div><div>template <typename><br>struct S{};</div><div><br></div><div>void Func2()<br>{<br> S<int> s;<br> Func(s);<br>}</div><div><br></div><div>If Func is declared as either of these, then type->getAs<TemplateSpecializationType>() returns a non-null value and type.getAsString() returns "S<int>":</div><div><br></div><div>void Func(...);</div><div><br></div><div>template <typename T><br>void Func(const T&);</div><div><br></div><div>If Func is declared as this, then type->getAs<TemplateSpecializationType>() returns null and type.getAsString() returns "struct S<int>":</div><div><br></div><div>template <typename T><br>void Func(T);</div><div><br></div><div><br></div><div><br></div><div>I would expect all three to return a non-null value and the same result from getAsString.  Why do these differ?</div></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" target="_blank" rel="noreferrer">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>