[llvm] DWARF: Emit `DW_AT_artificial` on artificial globals (PR #93118)

Josh Stone via llvm-commits llvm-commits at lists.llvm.org
Tue May 28 13:22:48 PDT 2024


cuviper wrote:

> In the local variable case the flag is carried on the variable, by the looks of it, which is sound/not the same as what's being proposed here.

It's effective on either -- the flag is checked here:

https://github.com/llvm/llvm-project/blob/c96860aea2c77392bad16f1c4f55014164669de3/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp#L1647-L1648

... and that method looks at _either_ the variable itself or its type:

https://github.com/llvm/llvm-project/blob/c96860aea2c77392bad16f1c4f55014164669de3/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h#L261-L268

AFAICS, we never output that flag on the actual type definition, even though the DWARF spec does allow that.

It may make sense to add flags to `DIGlobalVariable`, but I think we'd still want to check its type too for consistency.

https://github.com/llvm/llvm-project/pull/93118


More information about the llvm-commits mailing list