From 7e37c818f9f77608c602ffb32c1135e3cd0132a8 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Wed, 19 Aug 2009 18:30:37 +0000 Subject: [PATCH] Use raw_svector_ostream for string concatenation. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79444 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Rewrite/HTMLRewrite.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/Rewrite/HTMLRewrite.cpp b/lib/Rewrite/HTMLRewrite.cpp index bc29431dc3..68edda222b 100644 --- a/lib/Rewrite/HTMLRewrite.cpp +++ b/lib/Rewrite/HTMLRewrite.cpp @@ -202,17 +202,19 @@ std::string html::EscapeText(const std::string& s, bool EscapeSpaces, static void AddLineNumber(RewriteBuffer &RB, unsigned LineNo, unsigned B, unsigned E) { - llvm::SmallString<100> Str; - Str += ""; - Str.append_uint(LineNo); - Str += ""; + llvm::SmallString<256> Str; + llvm::raw_svector_ostream OS(Str); + + OS << "" + << LineNo << ""; if (B == E) { // Handle empty lines. - Str += " "; + OS << " "; + OS.flush(); RB.InsertTextBefore(B, &Str[0], Str.size()); } else { + OS.flush(); RB.InsertTextBefore(B, &Str[0], Str.size()); RB.InsertTextBefore(E, "", strlen("")); }