[PATCH] D71508: [DebugInfo] Duplicate file names in debug info

kamlesh kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 13 21:27:57 PST 2019


kamleshbhalui created this revision.
kamleshbhalui added reviewers: probinson, dblaikie, vsk, labath.
kamleshbhalui added a project: debug-info.
Herald added subscribers: cfe-commits, aprantl.
Herald added a project: clang.

strip/remove the dot slash before creating files for debug info.
This fixes https://bugs.llvm.org/show_bug.cgi?id=44170

I am unable to add a test for this.
since it requires to pass command like this.
$clang ./t.c -g -emit-llvm -S


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71508

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp


Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -409,6 +409,10 @@
     // If the location is not valid then use main input file.
     return TheCU->getFile();
 
+  if (!llvm::sys::path::is_absolute(FileName)) {
+      FileName = llvm::sys::path::remove_leading_dotslash(FileName);
+    }
+
   // Cache the results.
   auto It = DIFileCache.find(FileName.data());
   if (It != DIFileCache.end()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71508.233914.patch
Type: text/x-patch
Size: 537 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191214/cbe76da9/attachment-0001.bin>


More information about the cfe-commits mailing list