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()?

On 20 April 2015 at 07:58, Manuel Klimek <[email protected]> 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
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



-- 
*Indefiant *: http://www.indefiant.com
Home of Recode : Runtime C++ Editing for VS
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to