<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Thanks Yaron and Stephan,<br>
<br>
Using QualType::dump(), I found <br>
Decl.getType()->getAs<TemplateSpecializationType>()->getArg(0).getAsType().getAsString()
!<br>
I had to go back in the code as my former specDecl had already
lost the real type information.<br>
<br>
QualType::dump() is a killer feature !<br>
<br>
Guillaume.<br>
<br>
On 25/01/16 19:55, Yaron Keren via cfe-dev wrote:<br>
</div>
<blockquote
cite="mid:CANa4zJo9Z=+cvr6kngK=Bkav4=99SqwVdodtWyPuQFF4PHj6bA@mail.gmail.com"
type="cite">
<div dir="rtl">
<div dir="ltr">Useful trick to see how such things are done is
to debug into the QualType::dump() method.</div>
<div dir="ltr"><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div dir="ltr">2016-01-25 18:48 GMT+02:00 Stephan Bergmann via
cfe-dev <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>:</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">On
01/25/2016 05:15 PM, Guillaume Maudoux (Layus) via cfe-dev
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
I am currently fighting with clang libs to get the "real"
type name of a<br>
template parameter.<br>
My current code obtains the "resolved" name of the type.<br>
<br>
For example, with a `typedef int myInt;`,<br>
templateArgs[0].getAsType().getAsString() returns "int"
instead of "myInt".<br>
<br>
const TemplateArgumentList& templateArgs =
specDecl->getTemplateArgs();<br>
<br>
assert(templateArgs.size() == 1);<br>
assert(templateArgs[0].getKind() ==
TemplateArgument::Type);<br>
return<br>
templateArgs[0].getAsType().getAsString(context->getPrintingPolicy());<br>
<br>
Is there some way to extract the type string used in the
source code,<br>
not the type infered by clang ?<br>
</blockquote>
<br>
Asked something similar two years ago, <<a
moz-do-not-send="true"
href="http://lists.llvm.org/pipermail/cfe-dev/2014-February/035161.html"
rel="noreferrer" target="_blank"><a class="moz-txt-link-freetext" href="http://lists.llvm.org/pipermail/cfe-dev/2014-February/035161.html">http://lists.llvm.org/pipermail/cfe-dev/2014-February/035161.html</a></a>>
"SubstTemplateTypeParmType and non-canonical replacement
type." But never found an answer.<br>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a moz-do-not-send="true"
href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a moz-do-not-send="true"
href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev"
rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
cfe-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a>
</pre>
</blockquote>
<br>
</body>
</html>