[cfe-dev] Recovering an unique ID for an unqualified type

Jordan Rose jordan_rose at apple.com
Mon Dec 3 09:44:40 PST 2012


On Dec 2, 2012, at 22:40 , Manuel Klimek <klimek at google.com> wrote:

> On Mon, Dec 3, 2012 at 12:29 AM, Sean Silva <silvas at purdue.edu> wrote:
> > Does clang stores some sort of unique ID for type definitions? I could
> > generate manually this id for each time I stumble upon a new QualType but
> > I'm looking if this is already made by the library.
> 
> libclang's USR's are probably the closest thing to this, but I don't
> think that is what you are looking for.
> 
> Inside one TU type pointers have identity - that is, there's only one Type* for the same type. That doesn't hold for QualTypes.

It doesn't? QualTypes are PointerIntPairs (value objects); two QualTypes should be equal if they have the same qualifiers and the same underlying Type.

Also, you have to decide if you want to take typedefs into consideration; if not, you should make sure to call getCanonicalType before comparing your QualTypes.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20121203/227210d5/attachment.html>


More information about the cfe-dev mailing list