Open mvanotti opened 1 month ago
Think it was just not implemented because no consumer asked for it (is my assumption). Out of curiosity, what would you use it for?
@llvm/issue-subscribers-clang-codegen
Author: Marco Vanotti (mvanotti)
Think it was just not implemented because no consumer asked for it (is my assumption). Out of curiosity, what would you use it for?
I don't particularly need it. I was looking at an issue in lldb0 and was wondering if there was a way to differentiate between const
and constexpr
variables, and a coworker pointed out that it was possible but was unsure that clang emitted that info.
@llvm/issue-subscribers-debuginfo
Author: Marco Vanotti (mvanotti)
Any particular DWARF-consumer feature you're planning to build with this functionality? (it's not immediately apparent to me what value this DWARF would provide to a consumer)
Any particular DWARF-consumer feature you're planning to build with this functionality? (it's not immediately apparent to me what value this DWARF would provide to a consumer)
I'm probably not the main consumer of this functionality 😅.
I was playing with lldb's python api building a program to keep track of variable values during a debugging session, and thought that knowing whether a variable was constexpr
would help me filter out some uninteresting variables. lldb doesn't expose this information currently, so even if it's available in clang, it will take some time until this becomes useful to me, and even then, it's just a nice-to-have and not something that I desperately need.
even if it's available in clang, it will take some time until this becomes useful to me, and even then, it's just a nice-to-have and not something that I desperately need.
Fair enough - good to have the context - thanks!
When declaring a C++ variable as
constexpr
, clang doesn't emitDW_AT_const_expr
inside theDW_TAG_variable
.See the following program for example:
Compiled with:
Using
clang version 19.0.0git (https://llvm.googlesource.com/llvm-project 3809e20afc68d7d03821f0ec59b928dcf9befbf4)
Using
$ llvm-dwarfdump ./program_with_constexpr
It's missing
DW_AT_const_expr
When I compile this with gcc: