[cfe-commits] r79444 - /cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
Daniel Dunbar
daniel at zuster.org
Wed Aug 19 11:30:37 PDT 2009
Author: ddunbar
Date: Wed Aug 19 13:30:37 2009
New Revision: 79444
URL: http://llvm.org/viewvc/llvm-project?rev=79444&view=rev
Log:
Use raw_svector_ostream for string concatenation.
Modified:
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=79444&r1=79443&r2=79444&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Wed Aug 19 13:30:37 2009
@@ -202,17 +202,19 @@
static void AddLineNumber(RewriteBuffer &RB, unsigned LineNo,
unsigned B, unsigned E) {
- llvm::SmallString<100> Str;
- Str += "<tr><td class=\"num\" id=\"LN";
- Str.append_uint(LineNo);
- Str += "\">";
- Str.append_uint(LineNo);
- Str += "</td><td class=\"line\">";
+ llvm::SmallString<256> Str;
+ llvm::raw_svector_ostream OS(Str);
+
+ OS << "<tr><td class=\"num\" id=\"LN"
+ << LineNo << "\">"
+ << LineNo << "</td><td class=\"line\">";
if (B == E) { // Handle empty lines.
- Str += " </td></tr>";
+ OS << " </td></tr>";
+ OS.flush();
RB.InsertTextBefore(B, &Str[0], Str.size());
} else {
+ OS.flush();
RB.InsertTextBefore(B, &Str[0], Str.size());
RB.InsertTextBefore(E, "</td></tr>", strlen("</td></tr>"));
}
More information about the cfe-commits
mailing list