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/Pragma.cpp b/lib/Lex/Pragma.cpp
index 667e436..8603016 100644
--- a/lib/Lex/Pragma.cpp
+++ b/lib/Lex/Pragma.cpp
@@ -191,10 +191,8 @@
}
// Get the current file lexer we're looking at. Ignore _Pragma 'files' etc.
- unsigned FileID = getCurrentFileLexer()->getFileID();
-
// Mark the file as a once-only file now.
- HeaderInfo.MarkFileIncludeOnce(SourceMgr.getFileEntryForID(FileID));
+ HeaderInfo.MarkFileIncludeOnce(getCurrentFileLexer()->getFileEntry());
}
void Preprocessor::HandlePragmaMark() {
@@ -256,8 +254,7 @@
PreprocessorLexer *TheLexer = getCurrentFileLexer();
// Mark the file as a system header.
- const FileEntry *File = SourceMgr.getFileEntryForID(TheLexer->getFileID());
- HeaderInfo.MarkFileSystemHeader(File);
+ HeaderInfo.MarkFileSystemHeader(TheLexer->getFileEntry());
// Notify the client, if desired, that we are in a new source file.
if (Callbacks)
@@ -299,8 +296,7 @@
return;
}
- unsigned FileID = getCurrentFileLexer()->getFileID();
- const FileEntry *CurFile = SourceMgr.getFileEntryForID(FileID);
+ const FileEntry *CurFile = getCurrentFileLexer()->getFileEntry();
// If this file is older than the file it depends on, emit a diagnostic.
if (CurFile && CurFile->getModificationTime() < File->getModificationTime()) {