For debug information, get the main file name from the source manager
rather than from the -main-file-name flag, since the source manager
has proper path information. Fixes <rdar://problem/7769538>.

llvm-svn: 98898
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 60aa4e7..323c458 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -104,9 +104,14 @@
 void CGDebugInfo::CreateCompileUnit() {
 
   // Get absolute path name.
-  std::string MainFileName = CGM.getCodeGenOpts().MainFileName;
-  if (MainFileName.empty())
+  SourceManager &SM = CGM.getContext().getSourceManager();
+  std::string MainFileName;  
+  if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
+    MainFileName = MainFile->getName();
+  else if (CGM.getCodeGenOpts().MainFileName.empty())
     MainFileName = "<unknown>";
+  else
+    MainFileName = CGM.getCodeGenOpts().MainFileName;
   llvm::sys::Path AbsFileName(MainFileName);
   AbsFileName.makeAbsolute();