<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
When I parse this code with an AST parser:<br>
<br>
<pre style="" class="default prettyprint prettyprinted"><code><span class="kwd">struct</span><span class="pln"> _poire </span><span class="pun">{</span><span class="pln">
</span><span class="kwd">int</span><span class="pln"> g</span><span class="pun">;</span><span class="pln">
</span><span class="kwd">char</span><span class="pln"> rouge</span><span class="pun">;</span><span class="pln"> </span><span class="com">// tomate is probably one of your classes so I just changed the type of the field.</span><span class="pln">
</span><span class="pun">};</span><span class="pln">
</span><span class="kwd">typedef</span><span class="pln"> </span><span class="kwd">struct</span><span class="pln"> _poire kudamono</span><span class="pun">;
</span></code>I have a <code>clang::TypedefDecl</code> then I get the <code>clang::QualType</code> of the typedef with <code>clang::TypedefDecl::getUnderlyingType()</code>
</pre>
<p>With the <code>QualType</code> if I use the <code>getAsString</code>
method I can find the "struct _poire" <code>std::string</code>.
All this is Ok. </p>
<p>The problem is if I try to see if this type is a canonical type,
with <code>QualType::isCanonical()</code>, it returns false.</p>
<p>So I try to get the canonical type with <code>QualType::getCanonicalType().getAsString()</code>
and it returns the same string "struct _poire".</p>
<p>according to the clang reference on type <a
href="http://clang.llvm.org/docs/InternalsManual.html#canonical-types">http://clang.llvm.org/docs/InternalsManual.html#canonical-types</a>
, I thought that the isCanonical() should return true when no
typedef is involved.</p>
<p>So what are really canonical type?<br>
</p>
<p>(more informations on my problem can be seen here <u><a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/25231080/clang-what-are-canonical-types">http://stackoverflow.com/questions/25231080/clang-what-are-canonical-types</a></u>
)<br>
</p>
<p>Cedlemo<br>
</p>
<br>
</body>
</html>