aboutsummaryrefslogtreecommitdiff
path: root/lib/Rewrite/HTMLRewrite.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-07-07 18:31:05 +0000
committerTed Kremenek <kremenek@apple.com>2008-07-07 18:31:05 +0000
commitf6f593fae2f0531b4bc06891941f7fbba5217618 (patch)
tree707e58d08cb84b402f3a78830cb86f75942b9b2c /lib/Rewrite/HTMLRewrite.cpp
parent88a96d6c3fe2b1b9d80b39c21cf7aca4aa9fcf08 (diff)
In a report-XXXXX.html, make the title include the name of the file with the bug. Patch by Jean-Daniel Dupas!
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002166.html git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53184 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/HTMLRewrite.cpp')
-rw-r--r--lib/Rewrite/HTMLRewrite.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp
index f17aa537ef..0a32df1c61 100644
--- a/lib/Rewrite/HTMLRewrite.cpp
+++ b/lib/Rewrite/HTMLRewrite.cpp
@@ -257,7 +257,8 @@ void html::AddLineNumbers(Rewriter& R, unsigned FileID) {
RB.InsertTextAfter(FileEnd - FileBeg, "</table>", strlen("</table>"));
}
-void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID) {
+void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID,
+ const char *title) {
const llvm::MemoryBuffer *Buf = R.getSourceMgr().getBuffer(FileID);
const char* FileStart = Buf->getBufferStart();
@@ -266,11 +267,14 @@ void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID) {
SourceLocation StartLoc = SourceLocation::getFileLoc(FileID, 0);
SourceLocation EndLoc = SourceLocation::getFileLoc(FileID, FileEnd-FileStart);
- // Generate header
- R.InsertCStrBefore(StartLoc,
- "<!doctype html>\n" // Use HTML 5 doctype
- "<html>\n<head>\n"
- "<style type=\"text/css\">\n"
+ std::ostringstream os;
+ os << "<!doctype html>\n" // Use HTML 5 doctype
+ "<html>\n<head>\n";
+
+ if (title)
+ os << "<title>" << html::EscapeText(title) << "</title>\n";
+
+ os << "<style type=\"text/css\">\n"
" body { color:#000000; background-color:#ffffff }\n"
" body { font-family:Helvetica, sans-serif; font-size:10pt }\n"
" h1 { font-size:14pt }\n"
@@ -314,8 +318,10 @@ void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID) {
" td.rowname {\n"
" text-align:right; font-weight:bold; color:#444444;\n"
" padding-right:2ex; }\n"
- "</style>\n</head>\n<body>");
+ "</style>\n</head>\n<body>";
+ // Generate header
+ R.InsertStrBefore(StartLoc, os.str());
// Generate footer
R.InsertCStrAfter(EndLoc, "</body></html>\n");