[cfe-commits] r48541 - /cfe/trunk/include/clang/Rewrite/Rewriter.h
Chris Lattner
clattner at apple.com
Wed Mar 19 09:25:15 PDT 2008
On Mar 19, 2008, at 1:00 AM, Ted Kremenek wrote:
> Author: kremenek
> Date: Wed Mar 19 03:00:50 2008
> New Revision: 48541
>
> URL: http://llvm.org/viewvc/llvm-project?rev=48541&view=rev
> Log:
> Integrated some of Chris's comments; check for an empty string in
> InsertStrXXX()
> before descending into the bowels of the Rewriter.
Thanks, but the problem is that c_str() is slow :), please switch to
&S[0] (which is the thing that doesn't work if S is empty)
-Chris
>
>
> Modified:
> cfe/trunk/include/clang/Rewrite/Rewriter.h
>
> Modified: cfe/trunk/include/clang/Rewrite/Rewriter.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Rewrite/Rewriter.h?rev=48541&r1=48540&r2=48541&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/include/clang/Rewrite/Rewriter.h (original)
> +++ cfe/trunk/include/clang/Rewrite/Rewriter.h Wed Mar 19 03:00:50
> 2008
> @@ -184,11 +184,11 @@
> }
>
> bool InsertStrBefore(SourceLocation Loc, const std::string& S) {
> - return InsertTextBefore(Loc, S.c_str(), S.size());
> + return S.empty() ? false : InsertTextBefore(Loc, S.c_str(),
> S.size());
> }
>
> bool InsertStrAfter(SourceLocation Loc, const std::string& S) {
> - return InsertTextAfter(Loc, S.c_str(), S.size());
> + return S.empty() ? false : InsertTextAfter(Loc, S.c_str(),
> S.size());
> }
>
>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list