<div dir="ltr">Minor nit: Couldn't you just scope the ostream & move the stack allocated string rather than allocating a new one from the std::string reference returned by str()?</div><div class="gmail_extra"><br><div class="gmail_quote">On 20 April 2015 at 07:58, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: klimek<br>
Date: Mon Apr 20 01:58:56 2015<br>
New Revision: 235286<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=235286&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=235286&view=rev</a><br>
Log:<br>
Fix bug in Replacement's toString on Windows (missing flush).<br>
<br>
Adapt function to LLVM coding style.<br>
<br>
Modified:<br>
cfe/trunk/lib/Tooling/Core/Replacement.cpp<br>
<br>
Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=235286&r1=235285&r2=235286&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=235286&r1=235285&r2=235286&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)<br>
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Mon Apr 20 01:58:56 2015<br>
@@ -77,11 +77,11 @@ bool Replacement::apply(Rewriter &Rewrit<br>
}<br>
<br>
std::string Replacement::toString() const {<br>
- std::string result;<br>
- llvm::raw_string_ostream stream(result);<br>
- stream << FilePath << ": " << ReplacementRange.getOffset() << ":+"<br>
+ std::string Result;<br>
+ llvm::raw_string_ostream Stream(Result);<br>
+ Stream << FilePath << ": " << ReplacementRange.getOffset() << ":+"<br>
<< ReplacementRange.getLength() << ":\"" << ReplacementText << "\"";<br>
- return result;<br>
+ return Stream.str();<br>
}<br>
<br>
bool operator<(const Replacement &LHS, const Replacement &RHS) {<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="background-color:rgb(255,255,255);color:rgb(68,68,68);font-family:Arial,Helvetica,sans-serif"><b>Indefiant </b>: <a href="http://www.indefiant.com" target="_blank">http://www.indefiant.com</a></span></div><div><span style="font-family:Arial,Helvetica,sans-serif"><font color="#999999">Home of Recode : Runtime C++ Editing for VS</font></span></div></div></div>
</div>