[llvm-commits] TypeBuilder helper class

Jeffrey Yasskin jyasskin at google.com
Sun Apr 12 17:16:49 PDT 2009


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?

I also don't have any tests that TypeBuilder<size_t, true> correctly
fails to compile. dejagnu could do it in theory, but Nick tells me
that it doesn't work for code that calls into LLVM.

Jeffrey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: typebuilder.patch
Type: application/octet-stream
Size: 25616 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20090412/c17b1771/attachment.obj>


More information about the llvm-commits mailing list