[LLVMdev] Associating types directly with debug metadata?
Pekka Nikander
pekka.nikander at nomadiclab.com
Thu Sep 30 10:28:42 PDT 2010
>>>> We want to avoid any Type class modification. Instead you can use pair in named metadata to match metadata with type.
>>>>
>>
>> I thought about that more, and I think the "right" way would be to have a syntax like
>>
>> !21 = metadata !{ type %struct.T, metadata !11 }
>>
>> or perhaps
>>
>> !21 = metadata !{ typeval %struct.T, metadata !11 }
>>
>> to avoid the problem with the keyword 'type'.
>>
>> Would that be worth doing? Apparently we can fake with our need, and use a null pointer instead. Technically, that would be wrong, but would work with the current code without any modifications:
>>
>> !21 = metadata !{ %struct.T *null, metadata !11 }
>
> I would recommend this approach.
But that would have a hacky feeling :-)
Anyway, I already implemented an early patch for making Types representable as Values. For that I created a new class, TypeValue, which represents a type as a value. An early patch for that enclosed. Works when reading or writing textual representations; no BC representation yet. And no test case yet.
This works well enough for our purposes; I don't have any incentive to go further unless someone else needs a similar kind of functionality.
--Pekka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TypeValue.diff
Type: application/octet-stream
Size: 11238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100930/eead66b4/attachment.obj>
More information about the llvm-dev
mailing list