<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Aug 11, 2014 at 10:29 AM, cedlemo <span dir="ltr"><<a href="mailto:cedlemo@gmx.com" target="_blank">cedlemo@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  

    
  
  <div bgcolor="#FFFFFF" text="#000000">
    When I parse this code with an AST parser:<br>
    <br>
    <pre><code><span>struct</span><span> _poire </span><span>{</span><span>
    </span><span>int</span><span> g</span><span>;</span><span>
    </span><span>char</span><span> rouge</span><span>;</span><span> </span><span>// tomate is probably one of your classes so I just changed the type of the field.</span><span>
</span><span>};</span><span>
</span><span>typedef</span><span> </span><span>struct</span><span> _poire kudamono</span><span>;

</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></div></blockquote><div>OK, but presumably it's a different QualType value, and this one's isCanonical() will return true? </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    <p>according to the clang reference on type <a href="http://clang.llvm.org/docs/InternalsManual.html#canonical-types" target="_blank">http://clang.llvm.org/docs/InternalsManual.html#canonical-types</a>
      , I thought that the isCanonical() should return true when no
      typedef is involved.</p></div></blockquote><div>No, there are lots of other things that can make a type non-canonical. <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
    <p>So what are really canonical type?<br>
    </p>
    <p>(more informations on my problem can be seen here <u><a href="http://stackoverflow.com/questions/25231080/clang-what-are-canonical-types" target="_blank">http://stackoverflow.com/questions/25231080/clang-what-are-canonical-types</a></u>
      )<span class="HOEnZb"><font color="#888888"><br>
    </font></span></p><span class="HOEnZb"><font color="#888888">
    <p>Cedlemo<br>
    </p>
    <br>
  </font></span></div>

<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>