IF directory name is empty then try to extract one using absolute file name.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfDebug.cpp
index 5618f09efe28c4e50595a369d4085b11a5bb937b..f41b7693badc7a8e6ce4332b3cfa453f2b0fce4d 100644 (file)
@@ -1805,6 +1805,11 @@ void DwarfDebug::constructCompileUnit(const MDNode *N) {
   DICompileUnit DIUnit(N);
   StringRef FN = DIUnit.getFilename();
   StringRef Dir = DIUnit.getDirectory();
+  if (Dir.empty()) {
+    sys::Path AbsFileDirName(FN);
+    AbsFileDirName.makeAbsolute();
+    Dir = AbsFileDirName.getDirname();
+  }
   unsigned ID = GetOrCreateSourceID(Dir, FN);
 
   DIE *Die = new DIE(dwarf::DW_TAG_compile_unit);