[clang] [Clang][DebugInfo] Use CGDebugInfo::createFile in CGDebugInfo::CreateCompileUnit (#83174) (PR #83175)

Aleksei Vetrov via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 12:01:46 PST 2024


https://github.com/noxwell created https://github.com/llvm/llvm-project/pull/83175

Use `CGDebugInfo::createFile` wrapper that handles file remapping and corner cases instead of directly using `DBuilder.createFile` in `CGDebugInfo::CreateCompileUnit`.

Fixes #83174

>From 704f9042bb357cb600894c2a5caf19d0a53cf059 Mon Sep 17 00:00:00 2001
From: Aleksei Vetrov <vvvvvv at google.com>
Date: Tue, 27 Feb 2024 19:50:13 +0000
Subject: [PATCH] [Clang][DebugInfo] Use CGDebugInfo::createFile in
 CGDebugInfo::CreateCompileUnit (#83174)

Use `CGDebugInfo::createFile` wrapper that handles file remapping and
corner cases instead of directly using `DBuilder.createFile` in
`CGDebugInfo::CreateCompileUnit`.

Fixes #83174
---
 clang/lib/CodeGen/CGDebugInfo.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index c2c01439f2dc99..2a24cc1a9dc020 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -628,9 +628,8 @@ void CGDebugInfo::CreateCompileUnit() {
   // file was specified with an absolute path.
   if (CSKind)
     CSInfo.emplace(*CSKind, Checksum);
-  llvm::DIFile *CUFile = DBuilder.createFile(
-      remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), CSInfo,
-      getSource(SM, SM.getMainFileID()));
+  llvm::DIFile *CUFile = createFile(
+      MainFileName, CSInfo, getSource(SM, SM.getMainFileID()));
 
   StringRef Sysroot, SDK;
   if (CGM.getCodeGenOpts().getDebuggerTuning() == llvm::DebuggerKind::LLDB) {



More information about the cfe-commits mailing list