Skip to content

Commit

Permalink
[RemoveDIs][Clang] Resolve DILocalVariables used by DbgRecords (llvm#…
Browse files Browse the repository at this point in the history
…90882)

This patch fixes debug records in clang, by adding support for debug
records to the only remaining place that refers to DbgVariableIntrinsics
directly and does not handle DbgVariableRecords.
  • Loading branch information
SLTozer authored May 2, 2024
1 parent dcf376a commit 8805465
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clang/lib/CodeGen/CGVTables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ static void resolveTopLevelMetadata(llvm::Function *Fn,
// they are referencing.
for (auto &BB : *Fn) {
for (auto &I : BB) {
for (llvm::DbgVariableRecord &DVR :
llvm::filterDbgVars(I.getDbgRecordRange())) {
auto *DILocal = DVR.getVariable();
if (!DILocal->isResolved())
DILocal->resolve();
}
if (auto *DII = dyn_cast<llvm::DbgVariableIntrinsic>(&I)) {
auto *DILocal = DII->getVariable();
if (!DILocal->isResolved())
Expand Down
2 changes: 2 additions & 0 deletions clang/test/CodeGenCXX/tmp-md-nodes2.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// REQUIRES: asserts
// RUN: %clang_cc1 -O0 -triple %itanium_abi_triple -debug-info-kind=limited -S -emit-llvm %s -o - | \
// RUN: FileCheck %s
// RUN: %clang_cc1 -O0 -triple %itanium_abi_triple -debug-info-kind=limited -S -emit-llvm -mllvm --experimental-debuginfo-iterators=true %s -o - | \
// RUN: FileCheck %s

// This test simply checks that the varargs thunk is created. The failing test
// case asserts.
Expand Down

0 comments on commit 8805465

Please sign in to comment.