[llvm-commits] [llvm] r109302 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Devang Patel dpatel at apple.com
Fri Jul 23 17:53:22 PDT 2010


Author: dpatel
Date: Fri Jul 23 19:53:22 2010
New Revision: 109302

URL: http://llvm.org/viewvc/llvm-project?rev=109302&view=rev
Log:
Use current working directory when Dirname is empty. This only happens when absolute source file path is used on compiler command line.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=109302&r1=109301&r2=109302&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jul 23 19:53:22 2010
@@ -1753,6 +1753,11 @@
 /// maps as well.
 unsigned DwarfDebug::GetOrCreateSourceID(StringRef DirName, StringRef FileName){
   unsigned DId;
+  if (DirName.empty()) {
+    llvm::sys::Path CWD = llvm::sys::Path::GetCurrentDirectory();
+    DirName = StringRef(CWD.c_str(), CWD.size());
+  }
+
   StringMap<unsigned>::iterator DI = DirectoryIdMap.find(DirName);
   if (DI != DirectoryIdMap.end()) {
     DId = DI->getValue();





More information about the llvm-commits mailing list