[clang] [clang][DebugInfo] Attach DW_AT_const_value to static data-member definitions if available (PR #72730)

Michael Buch via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 20 12:34:05 PST 2023


Michael137 wrote:

> Hmm, I can't quite tell from the test case updates in the patch, at least at a glance: How does this get encoded at the IR level? Do we end up with two DIGlobalVariableExpressions? One with the constant value expresison, and one that references the actual global variable? Or somehow encode both in one?

My understanding was that the DIExpression parameter to DIGlobalVariableExpression was empty for global variables with locations. So the patch just encodes the constant into that expression if it's otherwise empty.

My plan was to make [DwarfCompileUnit](https://llvm.org/doxygen/DwarfCompileUnit_8cpp_source.html#l00203) support global variables with locations *and* constants, which it currently assumes doesn't happen.

Let me know if I missed something here

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


More information about the cfe-commits mailing list