diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-04-09 15:40:40 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-04-09 15:40:40 +0000 |
| commit | f17d5758fc7809c1c18d84407aae1909a923ff5e (patch) | |
| tree | 5c28efe1bbbd7750d7e0b9272125ac9e50764eb7 | |
| parent | ef9a6fd5c20d76830cbfaa0d546085d75ed2a40d (diff) | |
| download | bcm5719-llvm-f17d5758fc7809c1c18d84407aae1909a923ff5e.tar.gz bcm5719-llvm-f17d5758fc7809c1c18d84407aae1909a923ff5e.zip | |
Micro-optimization: Don't use ostringstream when using a C-string literal
will work just fine.
llvm-svn: 49427
| -rw-r--r-- | clang/lib/Rewrite/HTMLRewrite.cpp | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index 3e0d71a5b6d..2b844da1fd5 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -188,46 +188,34 @@ void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned FileID) { // Generate header - { - std::ostringstream os; - - os << "<html>\n<head>\n" - << "<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:12pt }\n" - << " .code { border-spacing:0px; width:100%; }\n" - << " .code { font-family: \"Andale Mono\", monospace; font-size:10pt }\n" - << " .code { line-height: 1.2em }\n" - << " .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }\n" - << " .num { text-align:right; font-size: smaller }\n" - << " .num { color:#444444 }\n" - << " .line { padding-left: 1ex; border-left: 3px solid #ccc }\n" - << " .line { white-space: pre }\n" - << " .msg { background-color:#fff8b4; color:#000000 }\n" - << " .msg { -webkit-box-shadow:1px 1px 7px #000 }\n" - << " .msg { -webkit-border-radius:5px }\n" - << " .msg { font-family:Helvetica, sans-serif; font-size: smaller }\n" - << " .msg { font-weight: bold }\n" - << " .msg { float:left }\n" - << " .msg { padding:0.5em 1ex 0.5em 1ex }\n" - << " .msg { margin-top:10px; margin-bottom:10px }\n" - << " .mrange { background-color:#dfddf3 }\n" - << " .mrange { border-bottom:1px solid #6F9DBE }\n" - << " .PathIndex { font-weight: bold }\n" - << "</style>\n</head>\n<body>"; - - R.InsertStrBefore(StartLoc, os.str()); - } - + R.InsertCStrBefore(StartLoc, + "<html>\n<head>\n" + "<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:12pt }\n" + " .code { border-spacing:0px; width:100%; }\n" + " .code { font-family: \"Andale Mono\", monospace; font-size:10pt }\n" + " .code { line-height: 1.2em }\n" + " .num { width:2.5em; padding-right:2ex; background-color:#eeeeee }\n" + " .num { text-align:right; font-size: smaller }\n" + " .num { color:#444444 }\n" + " .line { padding-left: 1ex; border-left: 3px solid #ccc }\n" + " .line { white-space: pre }\n" + " .msg { background-color:#fff8b4; color:#000000 }\n" + " .msg { -webkit-box-shadow:1px 1px 7px #000 }\n" + " .msg { -webkit-border-radius:5px }\n" + " .msg { font-family:Helvetica, sans-serif; font-size: smaller }\n" + " .msg { font-weight: bold }\n" + " .msg { float:left }\n" + " .msg { padding:0.5em 1ex 0.5em 1ex }\n" + " .msg { margin-top:10px; margin-bottom:10px }\n" + " .mrange { background-color:#dfddf3 }\n" + " .mrange { border-bottom:1px solid #6F9DBE }\n" + " .PathIndex { font-weight: bold }\n" + "</style>\n</head>\n<body>"); + // Generate footer - { - std::ostringstream os; - - os << "</body></html>\n"; - R.InsertStrAfter(EndLoc, os.str()); - } + R.InsertCStrAfter(EndLoc, "</body></html>\n"); } - - |

