r235286 - Fix bug in Replacement's toString on Windows (missing flush).
Manuel Klimek
klimek at google.com
Mon Apr 20 08:16:52 PDT 2015
On Mon, Apr 20, 2015 at 4:34 PM Will Wilson <will at indefiant.com> wrote:
> 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()?
>
I'm not convinced that's better - mainly I don't think the copy will ever
matter in practice.
>
> On 20 April 2015 at 07:58, Manuel Klimek <klimek at google.com> wrote:
>
>> Author: klimek
>> Date: Mon Apr 20 01:58:56 2015
>> New Revision: 235286
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=235286&view=rev
>> Log:
>> Fix bug in Replacement's toString on Windows (missing flush).
>>
>> Adapt function to LLVM coding style.
>>
>> Modified:
>> cfe/trunk/lib/Tooling/Core/Replacement.cpp
>>
>> Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=235286&r1=235285&r2=235286&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
>> +++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Mon Apr 20 01:58:56 2015
>> @@ -77,11 +77,11 @@ bool Replacement::apply(Rewriter &Rewrit
>> }
>>
>> std::string Replacement::toString() const {
>> - std::string result;
>> - llvm::raw_string_ostream stream(result);
>> - stream << FilePath << ": " << ReplacementRange.getOffset() << ":+"
>> + std::string Result;
>> + llvm::raw_string_ostream Stream(Result);
>> + Stream << FilePath << ": " << ReplacementRange.getOffset() << ":+"
>> << ReplacementRange.getLength() << ":\"" << ReplacementText <<
>> "\"";
>> - return result;
>> + return Stream.str();
>> }
>>
>> bool operator<(const Replacement &LHS, const Replacement &RHS) {
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>
>
>
>
> --
> *Indefiant *: http://www.indefiant.com
> Home of Recode : Runtime C++ Editing for VS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150420/bffed1fb/attachment.html>
More information about the cfe-commits
mailing list