Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient.  Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44878 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/RewriteTest.cpp b/Driver/RewriteTest.cpp
index 77adafe..cc10ab0 100644
--- a/Driver/RewriteTest.cpp
+++ b/Driver/RewriteTest.cpp
@@ -64,7 +64,7 @@
   public:
     void Initialize(ASTContext &context, unsigned mainFileID) {
       Context = &context;
-      SM = &Context->SourceMgr;
+      SM = &Context->getSourceManager();
       MsgSendFunctionDecl = 0;
       MsgSendSuperFunctionDecl = 0;
       MsgSendStretFunctionDecl = 0;
@@ -87,7 +87,7 @@
       MainFileEnd = MainBuf->getBufferEnd();
       
       
-      Rewrite.setSourceMgr(Context->SourceMgr);
+      Rewrite.setSourceMgr(Context->getSourceManager());
       // declaring objc_selector outside the parameter list removes a silly
       // scope related warning...
       const char *s = "struct objc_selector; struct objc_class;\n"
@@ -917,7 +917,8 @@
     unsigned DiagID = Diags.getCustomDiagID(Diagnostic::Error, 
                      "rewriter could not replace sub-expression due to macros");
     SourceRange Range = Exp->getSourceRange();
-    Diags.Report(Exp->getAtLoc(), DiagID, 0, 0, &Range, 1);
+    Diags.Report(Exp->getAtLoc(), DiagID, Context->getSourceManager(),
+                 0, 0, &Range, 1);
     delete Replacement;
     return Exp;
   }