[cfe-commits] r157359 - in /cfe/trunk: lib/Rewrite/RewriteModernObjC.cpp test/Rewriter/rewrite-modern-atautoreleasepool.mm

Jordy Rose jediknil at belkadan.com
Wed May 23 17:45:57 PDT 2012


On May 23, 2012, at 19:47, Fariborz Jahanian wrote:

> +Stmt *RewriteModernObjC::RewriteObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt  *S) {
> +  SourceLocation startLoc = S->getAtLoc();
> +  ReplaceText(startLoc, strlen("@autoreleasepool"), "/* @autoreleasepool */");
> +  std::string buf;
> +  buf = "{ __AtAutoreleasePool __autoreleasepool; ";
> +  ReplaceText(S->getSubStmt()->getLocStart(), 1, buf);

You have a literal string copied into a std::string and then passed to ReplaceText. Why not pass it directly, as with the first replacement? Or if this is about line length, maybe use a StringRef variable instead of a std::string?





More information about the cfe-commits mailing list