[clang] [RemoveDIs][Clang] Resolve DILocalVariables used by DbgRecords (PR #90882)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 2 10:57:59 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-clang
Author: Stephen Tozer (SLTozer)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/90882.diff
2 Files Affected:
- (modified) clang/lib/CodeGen/CGVTables.cpp (+6)
- (modified) clang/test/CodeGenCXX/tmp-md-nodes2.cpp (+2)
``````````diff
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/90882
More information about the cfe-commits
mailing list