Commit 7a54410
committed
[clang][DebugInfo] Clear retained nodes list of a vararg trunk's DISubprogram
This fixes an issue reported in
#166855 (comment),
that had been revealed after #166855 was merged.
`CodeGenFunction::GenerateVarArgsThunk` creates thunks for vararg
functions by cloning and modifying the function. It is different
from `CodeGenFunction::generateThunk`, which is used for Itanium ABI.
According to https://reviews.llvm.org/D39396,
`CodeGenFunction::GenerateVarArgsThunk` may be called before metadata
nodes are resolved. So, it tries to avoid remapping DISubprogram and all
metadata nodes it references inside `CloneFunction()` by manually
cloning DISubprogram.
When optimization level is not OptNone, all local variables are saved in
DISubprogram's retainedNodes field. When `CodeGenFunction::GenerateVarArgsThunk`
clones such DISubprogram without remapping, it produces a subprogram
with incorrectly-scoped retained nodes. It triggers Verifier checks
added in #166855.
To solve that, retained nodes list of a cloned DISubprogram is cleared.1 parent 46e9d63 commit 7a54410
File tree
3 files changed
+35
-0
lines changed- clang
- lib/CodeGen
- test/CodeGenCXX
3 files changed
+35
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
5 | 13 | | |
6 | 14 | | |
7 | 15 | | |
| |||
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments