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

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 27 12:02:50 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-codegen

Author: Aleksei Vetrov (noxwell)

<details>
<summary>Changes</summary>

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

Fixes #<!-- -->83174

---
Full diff: https://github.com/llvm/llvm-project/pull/83175.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+2-3) 


``````````diff
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) {

``````````

</details>


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


More information about the cfe-commits mailing list