[RemoveDIs][Clang] Resolve DILocalVariables used by DbgRecords (#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.
This commit is contained in:
Stephen Tozer
2024-05-02 20:20:40 +01:00
committed by GitHub
parent dcf376aae7
commit 8805465e1d
2 changed files with 8 additions and 0 deletions

View File

@@ -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())

View File

@@ -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.