diff options
| author | Saleem Abdulrasool <compnerd@compnerd.org> | 2022-08-16 21:22:27 +0000 |
|---|---|---|
| committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2022-08-16 21:27:05 +0000 |
| commit | 585f62be1a438ca132aa443e556d102bc908a072 (patch) | |
| tree | eed220a57a59a9c91f295dedd48c60f043e02915 /clang/lib/CodeGen/CodeGenModule.cpp | |
| parent | ee986ab72711d838a7e7ff363c0d2efa7dba91e8 (diff) | |
CodeGen: correct handling of debug info generation for aliases
When aliasing a static array, the aliasee is going to be a GEP which
points to the value. We should strip pointer casts before forming the
reference. This was occluded by the use of opaque pointers.
This problem has existed since the introduction of the debug info
generation for aliases in b1ea0191a42074341847d767609f66a26b6d5a41. The
test case would assert due to the invalid cast with or without
`-no-opaque-pointers` at that revision.
Fixes: #57179
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index c30bccb1bbd3..0921008e254c 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -5338,7 +5338,7 @@ void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) { // Emit global alias debug information. if (isa<VarDecl>(D)) if (CGDebugInfo *DI = getModuleDebugInfo()) - DI->EmitGlobalAlias(cast<llvm::GlobalValue>(GA->getAliasee()), GD); + DI->EmitGlobalAlias(cast<llvm::GlobalValue>(GA->getAliasee()->stripPointerCasts()), GD); } void CodeGenModule::emitIFuncDefinition(GlobalDecl GD) { |
