]> granicus.if.org Git - clang/commitdiff
Micro-optimization: Don't use ostringstream when using a C-string literal
authorTed Kremenek <kremenek@apple.com>
Wed, 9 Apr 2008 15:40:40 +0000 (15:40 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 9 Apr 2008 15:40:40 +0000 (15:40 +0000)
will work just fine.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49427 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Rewrite/HTMLRewrite.cpp

index 3e0d71a5b6d09cdcc52d3ad26c9559217cf4384c..2b844da1fd5a3cd808487c173255f8b115ae7fc9 100644 (file)
@@ -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");
 }
-  
-