Push the rewriting APIs along.  Build a trivial client that replaces tabs
with x's for now.  The APIs are all unimplemented, so it doesn't do 
anything yet! :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42868 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Rewrite/Rewriter.cpp b/Rewrite/Rewriter.cpp
index c4856ad..19e9012 100644
--- a/Rewrite/Rewriter.cpp
+++ b/Rewrite/Rewriter.cpp
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang/Rewrite/Rewriter.h"
+#include "clang/Basic/SourceManager.h"
 using namespace clang;
 
 
@@ -24,3 +25,31 @@
                                const char *StrData, unsigned StrLen) {
   // FIXME:
 }
+
+
+
+//===----------------------------------------------------------------------===//
+// Rewriter class
+//===----------------------------------------------------------------------===//
+
+/// getEditBuffer - Get or create a RewriteBuffer for the specified FileID.
+///
+RewriteBuffer &Rewriter::getEditBuffer(unsigned FileID) {
+  std::map<unsigned, RewriteBuffer>::iterator I =
+    RewriteBuffers.lower_bound(FileID);
+  if (I != RewriteBuffers.end() && I->first == FileID) 
+    return I->second;
+  I = RewriteBuffers.insert(I, std::make_pair(FileID, RewriteBuffer()));
+  
+  std::pair<const char*, const char*> MB = SourceMgr.getBufferData(FileID);
+  I->second.Initialize(MB.first, MB.second);
+  
+  return I->second;
+}
+
+
+void Rewriter::ReplaceText(SourceLocation Start, unsigned OrigLength,
+                           const char *NewStr, unsigned NewLength) {
+  assert(isRewritable(Start) && "Not a rewritable location!");
+  
+}