[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:06:59 PST 2024


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

>From 237264fded2b9806d273d7bc5d593a7dd0011850 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..22cb3492ebe11a 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