diff options
author | Michael Buch <michaelbuch12@gmail.com> | 2023-11-30 10:41:24 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-30 10:41:24 +0000 |
commit | 53a24c33f09b81b8f009afbabd05f7086db3f288 (patch) | |
tree | d27e1de9b0416efefc74fa9cc66644924a9fe726 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | e620035a28d5d957623aa7b4aeda35ab5130e2c9 (diff) | |
download | llvm-53a24c33f09b81b8f009afbabd05f7086db3f288.zip llvm-53a24c33f09b81b8f009afbabd05f7086db3f288.tar.gz llvm-53a24c33f09b81b8f009afbabd05f7086db3f288.tar.bz2 |
[clang][DebugInfo] Improve heuristic to determine whether to evaluate a static variable's initializer (#72974)
This patch extracts the logic to evaluate a C++ static data-member's
constant initializer. This logic will be re-used in an upcoming patch.
It also makes the check for whether we are dealing with a constant
initializer more robust/idiomatic, which revealed a bug in the
`debug-info-static-inline-member` test (which existed since its
introduction in https://github.com/llvm/llvm-project/pull/71780)
**Test changes**
* `debug-info-static-member.cpp`:
* We added the check for `const_b` as part of the
patch series in `638a8393615e911b729d5662096f60ef49f1c65e`.
The check for `isUsableAsConstantExpression` added in the current patch
doesn't support constant inline floats (since they are neither constexpr
nor
integrals). This isn't a regression since before said patch series
we wouldn't ever emit the definition for `const_b` anyway. Now
we just don't do it for `inline const float`s. This is consistent with
GCC's behaviour starting with C++11.
* `debug-info-static-inline-member`:
* This was just a bug which is now fixed. We shouldn't emit
a `DW_AT_const_value` for a non-const static.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions