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 | 2b2453a7d8fe732561795431f39ceb2b2a832d84 (patch) | |
tree | ad3d68197002f997b30e6617e41e290eff963b03 /include/clang/Lex/Preprocessor.h | |
parent | 05816591ec488a933dfecc9ff9f3cbf3c32767c2 (diff) |
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
Diffstat (limited to 'include/clang/Lex/Preprocessor.h')
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index b85c725490..e453fd04d6 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -284,7 +284,7 @@ public: /// EnterSourceFile - Add a source file to the top of the include stack and /// start lexing tokens from it instead of the current buffer. If isMainFile /// is true, this is the main file for the translation unit. - void EnterSourceFile(unsigned CurFileID, const DirectoryLookup *Dir); + void EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir); /// EnterMacro - Add a Macro to the top of the include stack and start lexing /// tokens from it instead of the current buffer. Args specifies the @@ -456,10 +456,8 @@ public: char getSpelledCharacterAt(SourceLocation SL) const { if (PTH) { SL = SourceMgr.getSpellingLoc(SL); - unsigned FID = SourceMgr.getCanonicalFileID(SL); - unsigned FPos = SourceMgr.getFullFilePos(SL); const char *Data; - if (PTH->getSpelling(FID, FPos, Data)) + if (PTH->getSpelling(SL, Data)) return *Data; } |