Keeps track of the enums that were used by saving them as DIGlobalVariables,
since CodeView emits debug info for global constants.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Is it practical/possible to do this in LLVM rather than in Clang? I'd have thought it'd be best to keep the IR metadata as output-format agnostic as practical/possible to reduce divergent codepaths, etc?
The used enums would still end up in the 'enums' list for the DICompileUnit, right? (If CodeView needs more enums in the list than DWARF does - yeah, that's probably a necessary frontend change - to put the extra needed enums in the enums list)
They should all be there, but emitting the unused enums makes the binary sizes larger. (I think around 6% increase? I forget the size difference for only emitting used enums)
We did things this way to track which enumerators were used, not which enums were used. Size data showed it was worth doing (6%). The existing format doesn't support tracking usage of individual enumerators, so we pretended they were const integers to avoid changing the schema.
Ah - describing all the enumerators in any emitted enum would be too many bits/too much size in output?
Ah, OK - unused enumerators in used enumerations, rather than all unused enumerators in all enumerations unused or used... I'm with you now. Thanks!