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/clang.cpp b/Driver/clang.cpp
index eb469d8..c009e06 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -989,10 +989,10 @@
   std::auto_ptr<TextDiagnostics> DiagClient;
   if (!VerifyDiagnostics) {
     // Print diagnostics to stderr by default.
-    DiagClient.reset(new TextDiagnosticPrinter(SourceMgr));
+    DiagClient.reset(new TextDiagnosticPrinter());
   } else {
     // When checking diagnostics, just buffer them up.
-    DiagClient.reset(new TextDiagnosticBuffer(SourceMgr));
+    DiagClient.reset(new TextDiagnosticBuffer());
    
     if (InputFilenames.size() != 1) {
       fprintf(stderr,
@@ -1013,7 +1013,7 @@
   { // Create triples, and create the TargetInfo.
     std::vector<std::string> triples;
     CreateTargetTriples(triples);
-    Target = CreateTargetInfo(triples,&Diags);
+    Target = CreateTargetInfo(SourceMgr,triples,&Diags);
   
     if (Target == 0) {
       fprintf(stderr, "Sorry, I don't know what target this is: %s\n",
@@ -1026,7 +1026,9 @@
   // -I- is a deprecated GCC feature, scan for it and reject it.
   for (unsigned i = 0, e = I_dirs.size(); i != e; ++i) {
     if (I_dirs[i] == "-") {
-      Diags.Report(SourceLocation(), diag::err_pp_I_dash_not_supported);
+      Diags.Report(SourceLocation(), diag::err_pp_I_dash_not_supported,
+                   SourceMgr);
+      
       I_dirs.erase(I_dirs.begin()+i);
       --i;
     }