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

Jordan Rose jordan_rose at apple.com
Mon Dec 3 09:48:14 PST 2012


On Dec 3, 2012, at 9:46 , Manuel Klimek <klimek at google.com> wrote:

> On Mon, Dec 3, 2012 at 6:44 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> 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.
> 
> That means that QualTypes don't have pointer identity (was all I was trying to say :) - sorry if that was not clear.

Ah, okay. I thought you meant you can't compare them with == and get a meaningful result, which you can. (Of course, usually I shoot my self in the foot by forgetting the canonicalization in cases where it's needed...)

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


More information about the cfe-dev mailing list