https://github.com/SLTozer created https://github.com/llvm/llvm-project/pull/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. >From d4e716205806b73366add260e4a580ae59bc0573 Mon Sep 17 00:00:00 2001 From: Stephen Tozer <stephen.to...@sony.com> Date: Thu, 2 May 2024 18:40:15 +0100 Subject: [PATCH] [RemoveDIs][Clang] Resolve DILocalVariables used by DbgRecords 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. --- clang/lib/CodeGen/CGVTables.cpp | 6 ++++++ clang/test/CodeGenCXX/tmp-md-nodes2.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp index 862369ae009f48..8d9c22546b4208 100644 --- a/clang/lib/CodeGen/CGVTables.cpp +++ b/clang/lib/CodeGen/CGVTables.cpp @@ -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()) diff --git a/clang/test/CodeGenCXX/tmp-md-nodes2.cpp b/clang/test/CodeGenCXX/tmp-md-nodes2.cpp index e50220cfb7c370..e88fb79b777ff6 100644 --- a/clang/test/CodeGenCXX/tmp-md-nodes2.cpp +++ b/clang/test/CodeGenCXX/tmp-md-nodes2.cpp @@ -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. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits