Use current working directory when Dirname is empty. This only happens when absolute...
authorDevang Patel <dpatel@apple.com>
Sat, 24 Jul 2010 00:53:22 +0000 (00:53 +0000)
committerDevang Patel <dpatel@apple.com>
Sat, 24 Jul 2010 00:53:22 +0000 (00:53 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109302 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index 5618f09efe28c4e50595a369d4085b11a5bb937b..b81aad92cbb9f4474d28cb7c5d85474d53e50799 100644 (file)
@@ -1753,6 +1753,11 @@ DIE *DwarfDebug::constructScopeDIE(DbgScope *Scope) {
 /// 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();