diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-02 20:44:16 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-02 20:44:16 +0000 |
commit | b94763963d2c889a59a55498f48d758c92d59ca0 (patch) | |
tree | 4d658357b85f35a0f32b5606822f1619fc475a0b /Driver/HTMLDiagnostics.cpp | |
parent | 22d6a639ce04ababc6900ea8b50ed7167db0f39c (diff) |
Embed BUGLINE, BUGFILE, BUGPATHLENGTH in the emitted HTML file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49114 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/HTMLDiagnostics.cpp')
-rw-r--r-- | Driver/HTMLDiagnostics.cpp | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp index 82696664ac..d4b481bfda 100644 --- a/Driver/HTMLDiagnostics.cpp +++ b/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 << "<h1>"; + // Add the name of the file as an <h1> 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()) << "</h1>\n"; + os << "<h1>" << html::EscapeText(DirName) + << "/" << html::EscapeText(Entry->getName()) << "</h1>\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<!-- BUGDESC " << BugDesc << " -->\n"; R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); - } + } + + { + std::ostringstream os; + os << "\n<!-- BUGFILE " << DirName << "/" << Entry->getName() << " -->\n"; + R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); + } + + { + std::ostringstream os; + os << "\n<!-- BUGLINE " << D.back()->getLocation().getLineNumber() + << " -->\n"; + R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); + } + + { + std::ostringstream os; + os << "\n<!-- BUGPATHLENGTH " << D.size() << " -->\n"; + R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str()); + } // Add CSS, header, and footer. |