For HTMLDiagnostics, when emitting the name of the directory, substitute the current working directory for "."

llvm-svn: 48888
This commit is contained in:
Ted Kremenek 2008-03-27 17:25:28 +00:00
parent 296b4c1bc6
commit 30560caa3d
1 changed files with 11 additions and 3 deletions

View File

@ -115,10 +115,18 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) {
{
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());
}