aboutsummaryrefslogtreecommitdiff
path: root/Driver/HTMLDiagnostics.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-03-27 07:35:49 +0000
committerTed Kremenek <kremenek@apple.com>2008-03-27 07:35:49 +0000
commit2e93981a6262a7dae968ff8af38139d5b0cd1bbc (patch)
tree77d520018c69433c729183d96dd53f5972100f6a /Driver/HTMLDiagnostics.cpp
parentfb5610d016dc4779cc06a1aeff226b2870d27227 (diff)
Added <h3> tag in HTML file output that contains the name of the source file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/HTMLDiagnostics.cpp')
-rw-r--r--Driver/HTMLDiagnostics.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp
index 5e4ba971eb..6583064d18 100644
--- a/Driver/HTMLDiagnostics.cpp
+++ b/Driver/HTMLDiagnostics.cpp
@@ -13,6 +13,7 @@
#include "HTMLDiagnostics.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Basic/FileManager.h"
#include "clang/AST/ASTContext.h"
#include "clang/Analysis/PathDiagnostic.h"
#include "clang/Rewrite/Rewriter.h"
@@ -105,11 +106,21 @@ void HTMLDiagnostics::HandlePathDiagnostic(const PathDiagnostic& D) {
}
// Add line numbers, header, footer, etc.
+
unsigned FileID = R.getSourceMgr().getMainFileID();
html::EscapeText(R, FileID);
html::AddLineNumbers(R, FileID);
- // FIXME: Add the number of the file here.
+ // Add the name of the file.
+
+ {
+ std::ostringstream os;
+ const FileEntry* Entry = SMgr.getFileEntryForID(FileID);
+
+ os << "<h1>" << Entry->getName() << "</h1>\n";
+
+ R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
+ }
// Add CSS, header, and footer.