Added formatAndApplyAllReplacements that works on multiple files in libTooling.

Summary:
formatAndApplyAllReplacements takes a set of Replacements, applies them on a
Rewriter, and reformats the changed code.

Reviewers: klimek, djasper

Subscribers: ioeric, klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D17852

llvm-svn: 264745
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 40ff01f..37788df 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -1998,7 +1998,7 @@
 
   std::string NewCode = applyAllReplacements(Code, Replaces);
   std::vector<tooling::Range> ChangedRanges =
-      tooling::calculateChangedRangesInFile(Replaces);
+      tooling::calculateChangedRanges(Replaces);
   StringRef FileName = Replaces.begin()->getFilePath();
   tooling::Replacements FormatReplaces =
       reformat(Style, NewCode, ChangedRanges, FileName);
@@ -2009,16 +2009,6 @@
   return MergedReplacements;
 }
 
-std::string applyAllReplacementsAndFormat(StringRef Code,
-                                          const tooling::Replacements &Replaces,
-                                          const FormatStyle &Style) {
-  tooling::Replacements NewReplacements =
-      formatReplacements(Code, Replaces, Style);
-  if (NewReplacements.empty())
-    return Code; // Exit early to avoid overhead in `applyAllReplacements`.
-  return applyAllReplacements(Code, NewReplacements);
-}
-
 tooling::Replacements reformat(const FormatStyle &Style,
                                SourceManager &SourceMgr, FileID ID,
                                ArrayRef<CharSourceRange> Ranges,