[llvm-commits] TypeBuilder helper class

Jeffrey Yasskin jyasskin at google.com
Thu Apr 30 14:23:07 PDT 2009


On Sat, Apr 25, 2009 at 3:15 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Apr 12, 2009, at 5:16 PM, Jeffrey Yasskin wrote:
>
>> On Thu, Apr 9, 2009 at 11:38 PM, Chris Lattner <clattner at apple.com>
>> wrote:
>>>
>>> On Apr 9, 2009, at 9:40 AM, Jeffrey Yasskin wrote:
>>>
>>>>
>>>> I think I see how to define TypeBuilder<typename T, bool
>>>> restrict_to_cross_compilable_types> so that TypeBuilder<size_t,
>>>> true>
>>>> fails to compile but TypeBuilder<sometype<64>, false> succeeds,
>>>> without duplicating code. Could you confirm that that's along the
>>>> lines of what you want implemented before I waste time implementing
>>>> it? Also, what's the right spelling for "sometype"? I'd vote for
>>>> llvm::types::i<N> or something similar.
>>>>
>>>
>>> Sounds great to me!
>>
>> Ok, here's the new version. I'm not entirely happy with using a bool
>> for this decision since it makes user code harder to read. I could use
>> an enum or distinct subtypes, but then I'd need names. "Host" seems to
>> work for the version that accepts types like 'size_t', but
>> "CrossCompilable" seems too long for the version that doesn't.
>> Thoughts?
>
> This looks great!  Can you please add some mention of this to the
> programmer's manual?
> http://llvm.org/docs/ProgrammersManual.html
>
> Perhaps a "how to create types" entry in the "Helpful Hints for Common
> Operations" section.

Here's a patch that does that and cleans up some of the class comment
in TypeBuilder.h.

Jeffrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TypeBuilder_doc.patch
Type: text/x-diff
Size: 3571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090430/a7600c22/attachment.patch>


More information about the llvm-commits mailing list