this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation.  *That* FileID may refer to the start of a file or to a
chunk within it.  The new FileID *only* refers to the file (and its 
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPLexerChange.cpp b/lib/Lex/PPLexerChange.cpp
index 0ecca3a..cc8ccc4 100644
--- a/lib/Lex/PPLexerChange.cpp
+++ b/lib/Lex/PPLexerChange.cpp
@@ -66,8 +66,7 @@
 /// EnterSourceFile - Add a source file to the top of the include stack and
 /// start lexing tokens from it instead of the current buffer.  Return true
 /// on failure.
-void Preprocessor::EnterSourceFile(unsigned FileID,
-                                   const DirectoryLookup *CurDir) {
+void Preprocessor::EnterSourceFile(FileID FID, const DirectoryLookup *CurDir) {
   assert(CurTokenLexer == 0 && "Cannot #include a file inside a macro!");
   ++NumEnteredSourceFiles;
   
@@ -75,8 +74,7 @@
     MaxIncludeStackDepth = IncludeMacroStack.size();
 
   if (PTH) {
-    PTHLexer* PL =
-      PTH->CreateLexer(FileID, getSourceManager().getFileEntryForID(FileID));
+    PTHLexer *PL = PTH->CreateLexer(FID, SourceMgr.getFileEntryForID(FID));
 
     if (PL) {
       EnterSourceFileWithPTH(PL, CurDir);
@@ -84,7 +82,7 @@
     }
   }
   
-  Lexer *TheLexer = new Lexer(SourceLocation::getFileLoc(FileID, 0), *this);
+  Lexer *TheLexer = new Lexer(SourceMgr.getLocForStartOfFile(FID), *this);
   EnterSourceFileWithLexer(TheLexer, CurDir);
 }  
 
@@ -125,10 +123,9 @@
 
   // Notify the client, if desired, that we are in a new source file.
   if (Callbacks) {
-    unsigned FileID = CurPPLexer->getFileID();
-    SrcMgr::CharacteristicKind FileType =
-      SourceMgr.getFileCharacteristic(CurPPLexer->getFileID());    
-    Callbacks->FileChanged(SourceLocation::getFileLoc(FileID, 0),
+    FileID FID = CurPPLexer->getFileID();
+    SrcMgr::CharacteristicKind FileType = SourceMgr.getFileCharacteristic(FID);
+    Callbacks->FileChanged(SourceMgr.getLocForStartOfFile(FID),
                            PPCallbacks::EnterFile, FileType);
   }
 }