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()) {


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()) {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to