Fixed a bug in the code to create a dwarf file and directory table entires when
[oota-llvm.git] / lib / MC / MCContext.cpp
index 814726ebd8c0f54615be75624f78515ab03181f3..a1a01e3bad8037ead8678f97c8d05fe8314823ee 100644 (file)
@@ -273,8 +273,10 @@ unsigned MCContext::GetDwarfFile(StringRef Directory, StringRef FileName,
     // Separate the directory part from the basename of the FileName.
     std::pair<StringRef, StringRef> Slash = FileName.rsplit('/');
     Directory = Slash.second;
-    if (!Directory.empty())
-      FileName = Slash.first;
+    if (!Directory.empty()) {
+      Directory = Slash.first;
+      FileName = Slash.second;
+    }
   }
 
   // Find or make a entry in the MCDwarfDirs vector for this Directory.