Interned MainFileID within SourceManager. Since SourceManager is referenced by
both Preprocessor and ASTContext, we no longer need to explicitly pass
MainFileID around in function calls that also pass either Preprocessor or
ASTContext. This resulted in some nice cleanups in the ASTConsumers and the
driver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45228 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 1bb4a1a..f38c83a 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -878,9 +878,9 @@
 // Basic Parser driver
 //===----------------------------------------------------------------------===//
 
-static void ParseFile(Preprocessor &PP, MinimalAction *PA, unsigned MainFileID){
+static void ParseFile(Preprocessor &PP, MinimalAction *PA){
   Parser P(PP, *PA);
-  PP.EnterMainSourceFile(MainFileID);
+  PP.EnterMainSourceFile();
   
   // Parsing the specified input file.
   P.ParseTranslationUnit();
@@ -963,7 +963,7 @@
   case DumpTokens: {                 // Token dump mode.
     Token Tok;
     // Start parsing the specified input file.
-    PP.EnterMainSourceFile(MainFileID);
+    PP.EnterMainSourceFile();
     do {
       PP.Lex(Tok);
       PP.DumpToken(Tok, true);
@@ -975,7 +975,7 @@
   case RunPreprocessorOnly: {        // Just lex as fast as we can, no output.
     Token Tok;
     // Start parsing the specified input file.
-    PP.EnterMainSourceFile(MainFileID);
+    PP.EnterMainSourceFile();
     do {
       PP.Lex(Tok);
     } while (Tok.isNot(tok::eof));
@@ -984,18 +984,17 @@
   }
     
   case PrintPreprocessedInput:       // -E mode.
-    DoPrintPreprocessedInput(MainFileID, PP);
+    DoPrintPreprocessedInput(PP);
     ClearSourceMgr = true;
     break;
     
   case ParseNoop:                    // -parse-noop
-    ParseFile(PP, new MinimalAction(PP.getIdentifierTable()), MainFileID);
+    ParseFile(PP, new MinimalAction(PP.getIdentifierTable()));
     ClearSourceMgr = true;
     break;
     
   case ParsePrintCallbacks:
-    ParseFile(PP, CreatePrintParserActionsAction(PP.getIdentifierTable()), 
-              MainFileID);
+    ParseFile(PP, CreatePrintParserActionsAction(PP.getIdentifierTable()));
     ClearSourceMgr = true;
     break;
       
@@ -1006,10 +1005,10 @@
   
   if (Consumer) {
     if (VerifyDiagnostics)
-      exit(CheckASTConsumer(PP, MainFileID, Consumer));
+      exit(CheckASTConsumer(PP, Consumer));
     
     // This deletes Consumer.
-    ParseAST(PP, MainFileID, Consumer, Stats);
+    ParseAST(PP, Consumer, Stats);
   }
   
   if (Stats) {
@@ -1062,8 +1061,7 @@
     exit (1);
   }
   
-  // FIXME: only work on consumers that do not require MainFileID.
-  Consumer->Initialize(*TU->getContext(), 0);
+  Consumer->Initialize(*TU->getContext());
   
   for (TranslationUnit::iterator I=TU->begin(), E=TU->end(); I!=E; ++I)
     Consumer->HandleTopLevelDecl(*I);