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/Driver/CacheTokens.cpp b/Driver/CacheTokens.cpp
index 4693b20..d447b90 100644
--- a/Driver/CacheTokens.cpp
+++ b/Driver/CacheTokens.cpp
@@ -485,8 +485,8 @@
const llvm::MemoryBuffer *B = C.getBuffer();
if (!B) continue;
- unsigned FID = SM.createFileID(FE, SourceLocation(), SrcMgr::C_User);
- Lexer L(SourceLocation::getFileLoc(FID, 0), LOpts,
+ FileID FID = SM.createFileID(FE, SourceLocation(), SrcMgr::C_User);
+ Lexer L(SM.getLocForStartOfFile(FID), LOpts,
B->getBufferStart(), B->getBufferEnd(), B);
PM[FE] = LexTokens(L);
}