[clang] [lldb] [clang][DebugInfo] Emit global variable definitions for static data members with constant initializers (PR #70639)
Michael Buch via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 1 04:00:33 PDT 2023
Michael137 wrote:
Hmmm it seems like for `constexpr static` data members we don't get a symbol in the MachO the same way we do for out-of-line `const static`s that have a location:
```
struct Foo {
static const int val1;
static constexpr int val2 = 5;
};
const int Foo::val1 = 10;
$ nm a.out
0000000100003fa4 S __ZN3Foo4val1E
0000000100000000 T __mh_execute_header
0000000100003f90 T _main
```
LLDB can fish out the value out of `val1` by doing a `FindSymbol` on the mangled name. But that doesn't work with `val2` because it's not in the symbol table. @clayborg or @jasonmolenda probably know more about this.
Seems to me like if we want to drop the constant off of the declaration entirely, we need to lookup the variable definition in the accelerator table in DWARFASTParserClang when we're constructing the VarDecls.
https://github.com/llvm/llvm-project/pull/70639
More information about the cfe-commits
mailing list