From 3276af4c1a1415c163ccc0466fed4d8a64536283 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 2 Apr 2008 20:44:16 +0000 Subject: [PATCH] Embed BUGLINE, BUGFILE, BUGPATHLENGTH in the emitted HTML file. llvm-svn: 49114 --- clang/Driver/HTMLDiagnostics.cpp | 46 ++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/clang/Driver/HTMLDiagnostics.cpp b/clang/Driver/HTMLDiagnostics.cpp index 82696664ac41..d4b481bfdad6 100644 --- a/clang/Driver/HTMLDiagnostics.cpp +++ b/clang/Driver/HTMLDiagnostics.cpp @@ -114,27 +114,26 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) { html::EscapeText(R, FileID); html::AddLineNumbers(R, FileID); - // Add the name of the file. + // Get the full directory name of the analyzed file. + + const FileEntry* Entry = SMgr.getFileEntryForID(FileID); + std::string DirName(Entry->getDir()->getName()); - { - std::ostringstream os; + if (DirName == ".") + DirName = llvm::sys::Path::GetCurrentDirectory().toString(); - os << "

"; + // Add the name of the file as an

tag. - 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); + { + std::ostringstream os; - os << "/" << html::EscapeText(Entry->getName()) << "

\n"; + os << "

" << html::EscapeText(DirName) + << "/" << html::EscapeText(Entry->getName()) << "

\n"; R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); } - // Add the bug description. + // Embed meta-data tags. const std::string& BugDesc = D.getDescription(); @@ -142,7 +141,26 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) { std::ostringstream os; os << "\n\n"; R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); - } + } + + { + std::ostringstream os; + os << "\n\n"; + R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); + } + + { + std::ostringstream os; + os << "\n\n"; + R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); + } + + { + std::ostringstream os; + os << "\n\n"; + R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); + } // Add CSS, header, and footer. -- GitLab