DIEnumerator *createEnumerator(StringRef Name, int64_t Val); // add APInt Val overload

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

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

You might find it tricky to extend the metadata in a way that allowed passing an APInt down to the DWARF emitter. But, leaving aside that implementation detail, it looks like you have a valid use-case for proposing a patch that supports it.

–paulr