[llvm-dev] DIEnumerator *createEnumerator(StringRef Name, int64_t Val); // add APInt Val overload

Andrew Kelley via llvm-dev llvm-dev at lists.llvm.org
Sat Dec 2 21:35:24 PST 2017


In the Zig frontend, users can set the types of enums like this:

const Foo = enum (u64) {
    A = 18446744073709551615,
    B = 1,
    C = 2,
};

I cannot use the DebugInfo API
DIEnumerator *createEnumerator(StringRef Name, int64_t Val);
because 18446744073709551615 is outside the range of int64_t.

Even if this accepted an unsigned int, Zig frontend can do this:

const Bar = enum(u128) {
    A = 340282366920938463463374607431768211455,
    B = 1,
    C = 2,
};

Now we're *really* out of luck.

I read the Dwarf 4 spec, and it supports arbitrary integer values for
enumerator constants.

Can we add an overload to createEnumerator to accept an APInt?

Regards,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171203/6b65fa11/attachment.html>


More information about the llvm-dev mailing list