<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt">On Mon, Dec 3, 2012 at 12:29 AM, Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> Does clang stores some sort of unique ID for type definitions? I could<br>

> generate manually this id for each time I stumble upon a new QualType but<br>
> I'm looking if this is already made by the library.<br>
<br>
</div>libclang's USR's are probably the closest thing to this, but I don't<br>
think that is what you are looking for.<br></blockquote><div><br></div><div>Inside one TU type pointers have identity - that is, there's only one Type* for the same type. That doesn't hold for QualTypes.</div><div>
<br></div><div>Cheers,</div><div>/Manuel</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> Another question, Is possible to verify if a QualType is of some class X?<br>
> like:<br>
><br>
> QualType t;<br>
><br>
> if (t.isofclass<std::string>()) {<br>
> }<br>
<br>
</div>This is not generally possible. The compiler is on a "meta" level from<br>
the code being compiled, so types inside the source code of the<br>
compiler are not generally meaningful in this sense. You can ask "is<br>
this class called `string` in namespace `std`?", but arbitrary C++<br>
types "inside the compiler" are not related to types in the code being<br>
compiled. It is basically a Godel, Escher, Bach scenario.<br>
<br>
-- Sean Silva<br>
<div><div class="h5"><br>
On Sun, Dec 2, 2012 at 2:09 PM, Victor Vicente de Carvalho<br>
<<a href="mailto:victor.v.carvalho@gmail.com">victor.v.carvalho@gmail.com</a>> wrote:<br>
> Does clang stores some sort of unique ID for type definitions? I could<br>
> generate manually this id for each time I stumble upon a new QualType but<br>
> I'm looking if this is already made by the library.<br>
><br>
> Another question, Is possible to verify if a QualType is of some class X?<br>
> like:<br>
><br>
> QualType t;<br>
><br>
> if (t.isofclass<std::string>()) {<br>
> }<br>
><br>
><br>
> Victor<br>
><br>
</div></div>> _______________________________________________<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>
_______________________________________________<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>
</blockquote></div><br></div></div>