For HTMLDiagnostics, when emitting the name of the directory, substitute the current working directory for "."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48888 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp
index 93af223..a473695 100644
--- a/Driver/HTMLDiagnostics.cpp
+++ b/Driver/HTMLDiagnostics.cpp
@@ -115,10 +115,18 @@
{
std::ostringstream os;
- const FileEntry* Entry = SMgr.getFileEntryForID(FileID);
- os << "<h1>" << html::EscapeText(Entry->getDir()->getName())
- << "/" << html::EscapeText(Entry->getName()) << "</h1>\n";
+ os << "<h1>";
+
+ const FileEntry* Entry = SMgr.getFileEntryForID(FileID);
+ const char* dname = Entry->getDir()->getName();
+
+ if (strcmp(dname,".") == 0)
+ os << html::EscapeText(llvm::sys::Path::GetCurrentDirectory().toString());
+ else
+ os << html::EscapeText(dname);
+
+ os << "/" << html::EscapeText(Entry->getName()) << "</h1>\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}