diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-17 06:22:33 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-17 06:22:33 +0000 |
commit | d32480d3db582186355d575db0421dd2823080b6 (patch) | |
tree | d0eec11f7cf221334aba2016cb3c39c5b6d2710f /clang/lib/Lex/Pragma.cpp | |
parent | d250ef911f62cb317596ba0aef9e3d75ca056d36 (diff) | |
download | bcm5719-llvm-d32480d3db582186355d575db0421dd2823080b6.tar.gz bcm5719-llvm-d32480d3db582186355d575db0421dd2823080b6.zip |
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.
llvm-svn: 62407
Diffstat (limited to 'clang/lib/Lex/Pragma.cpp')
-rw-r--r-- | clang/lib/Lex/Pragma.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index 667e4361a83..860301650b1 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -191,10 +191,8 @@ void Preprocessor::HandlePragmaOnce(Token &OnceTok) { } // 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 @@ void Preprocessor::HandlePragmaSystemHeader(Token &SysHeaderTok) { 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 @@ void Preprocessor::HandlePragmaDependency(Token &DependencyTok) { 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()) { |