Commit 53a24c3
authored
[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 #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.1 parent e620035 commit 53a24c3
File tree
3 files changed
+31
-20
lines changed- clang
- lib/CodeGen
- test/CodeGenCXX
3 files changed
+31
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
72 | 95 | | |
73 | 96 | | |
74 | 97 | | |
| |||
5610 | 5633 | | |
5611 | 5634 | | |
5612 | 5635 | | |
5613 | | - | |
5614 | | - | |
5615 | | - | |
5616 | 5636 | | |
5617 | 5637 | | |
5618 | 5638 | | |
5619 | 5639 | | |
5620 | | - | |
| 5640 | + | |
5621 | 5641 | | |
5622 | 5642 | | |
5623 | 5643 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | 70 | | |
75 | 71 | | |
76 | 72 | | |
| |||
98 | 94 | | |
99 | 95 | | |
100 | 96 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | 97 | | |
107 | 98 | | |
108 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
0 commit comments