The new Obj-C rewriter is failing to flush a raw_string_ostream before using its results. Due to the destruction order of locals, it's causing a deallocated string to be used, leading to junk characters being written out. The problem was found on Windows.
The attached patch corrects the problem by adding the missing calls to flush. -- Eric Niebler BoostPro Computing http://www.boostpro.com
Index: lib/Rewrite/Rewriter.cpp =================================================================== --- lib/Rewrite/Rewriter.cpp (revision 129845) +++ lib/Rewrite/Rewriter.cpp (working copy) @@ -300,6 +300,7 @@ std::string SStr; llvm::raw_string_ostream S(SStr); To->printPretty(S, 0, PrintingPolicy(*LangOpts)); + S.flush(); const std::string &Str = S.str(); ReplaceText(From->getLocStart(), Size, Str); @@ -310,6 +311,7 @@ std::string SStr; llvm::raw_string_ostream S(SStr); From->printPretty(S, 0, PrintingPolicy(*LangOpts)); + S.flush(); return SStr; }
signature.asc
Description: OpenPGP digital signature
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
