[llvm] DWARF: Emit `DW_AT_artificial` on artificial globals (PR #93118)
Michael Buch via llvm-commits
llvm-commits at lists.llvm.org
Wed May 29 10:20:16 PDT 2024
Michael137 wrote:
> Perhaps other folks can chime in as to whether it's worth putting a Flags attribute on DIGlobalVariable
Agreed it would be nice to attach `DIFlagArtificial` on both the local and global `DIVariable`s
That would then also help for cases where the variable is artificial but the type is not. E.g., in this contrived example:
```
#include <utility>
struct Pair {
int x, y;
};
auto get() { return std::pair{1, 2}; }
auto [g_x, g_y] = get();
int main() {
auto [l_x, l_y] = get();
return g_x + g_y + l_x + l_y;
}
```
```
0x000007cc: DW_TAG_variable
DW_AT_name ("g_x")
DW_AT_type (0x000007d7 "int &&")
DW_AT_external (true)
DW_AT_decl_file ("/Users/michaelbuch/artificial.cpp")
DW_AT_decl_line (9)
DW_AT_location (DW_OP_addrx 0x1)
0x00000864: DW_TAG_variable
DW_AT_location (DW_OP_breg31 WSP+24)
DW_AT_name ("l_x")
DW_AT_type (0x000007d7 "int &&")
DW_AT_artificial (true)
```
just my 2c
https://github.com/llvm/llvm-project/pull/93118
More information about the llvm-commits
mailing list