Refactoring of Diagnostic class.

-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

llvm-svn: 119730
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp
index e576b8d..4fa7d1d 100644
--- a/clang/lib/Basic/SourceManager.cpp
+++ b/clang/lib/Basic/SourceManager.cpp
@@ -100,7 +100,7 @@
         Diag.SetDelayedDiagnostic(diag::err_cannot_open_file, 
                                   Entry->getName(), ErrorStr);
       else 
-        Diag.Report(FullSourceLoc(Loc, SM), diag::err_cannot_open_file)
+        Diag.Report(Loc, diag::err_cannot_open_file)
           << Entry->getName() << ErrorStr;
 
       Buffer.setInt(Buffer.getInt() | InvalidFlag);
@@ -120,7 +120,7 @@
         Diag.SetDelayedDiagnostic(diag::err_file_modified,
                                   Entry->getName());
       else
-        Diag.Report(FullSourceLoc(Loc, SM), diag::err_file_modified)
+        Diag.Report(Loc, diag::err_file_modified)
           << Entry->getName();
 
       Buffer.setInt(Buffer.getInt() | InvalidFlag);
@@ -147,7 +147,7 @@
         .Default(0);
 
       if (BOM) {
-        Diag.Report(FullSourceLoc(Loc, SM), diag::err_unsupported_bom)
+        Diag.Report(Loc, diag::err_unsupported_bom)
           << BOM << Entry->getName();
         Buffer.setInt(1);
       }
@@ -342,6 +342,15 @@
 // Private 'Create' methods.
 //===----------------------------------------------------------------------===//
 
+SourceManager::SourceManager(Diagnostic &Diag, FileManager &FileMgr,
+                             const FileSystemOptions &FSOpts)
+  : Diag(Diag), FileMgr(FileMgr), FileSystemOpts(FSOpts),
+    ExternalSLocEntries(0), LineTable(0), NumLinearScans(0),
+    NumBinaryProbes(0) {
+  clearIDTables();
+  Diag.setSourceManager(this);
+}
+
 SourceManager::~SourceManager() {
   delete LineTable;