diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-19 21:57:25 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-19 21:57:25 +0000 |
commit | 45245217bcf82bccad31d4eb63e2dc827c5dca35 (patch) | |
tree | 23707291ed965503dd47ff02f9d41a43fa3610ef /clang/lib/Lex/PPDirectives.cpp | |
parent | 78fb6214f39f2bec2468af7997dc0e43e0ef2188 (diff) | |
download | bcm5719-llvm-45245217bcf82bccad31d4eb63e2dc827c5dca35.tar.gz bcm5719-llvm-45245217bcf82bccad31d4eb63e2dc827c5dca35.zip |
- Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
(simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.
- Add 'FileID' to PreprocessorLexer, and have Preprocessor query this fileid
when looking up the FileEntry for a file
Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.
llvm-svn: 59666
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r-- | clang/lib/Lex/PPDirectives.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index ced7673ca23..a1216b15bcc 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -303,8 +303,8 @@ const FileEntry *Preprocessor::LookupFile(const char *FilenameStart, // info about where the current file is. const FileEntry *CurFileEnt = 0; if (!FromDir) { - SourceLocation FileLoc = getCurrentFileLexer()->getFileLoc(); - CurFileEnt = SourceMgr.getFileEntryForLoc(FileLoc); + unsigned FileID = getCurrentFileLexer()->getFileID(); + CurFileEnt = SourceMgr.getFileEntryForID(FileID); } // Do a standard file entry lookup. @@ -317,8 +317,8 @@ const FileEntry *Preprocessor::LookupFile(const char *FilenameStart, // Otherwise, see if this is a subframework header. If so, this is relative // to one of the headers on the #include stack. Walk the list of the current // headers on the #include stack and pass them to HeaderInfo. - if (CurLexer && !CurLexer->Is_PragmaLexer) { - if ((CurFileEnt = SourceMgr.getFileEntryForLoc(CurLexer->getFileLoc()))) + if (IsNonPragmaNonMacroLexer()) { + if ((CurFileEnt = SourceMgr.getFileEntryForID(CurPPLexer->getFileID()))) if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart, FilenameEnd, CurFileEnt))) return FE; @@ -326,9 +326,9 @@ const FileEntry *Preprocessor::LookupFile(const char *FilenameStart, for (unsigned i = 0, e = IncludeMacroStack.size(); i != e; ++i) { IncludeStackInfo &ISEntry = IncludeMacroStack[e-i-1]; - if (ISEntry.TheLexer && !ISEntry.TheLexer->Is_PragmaLexer) { + if (IsNonPragmaNonMacroLexer(ISEntry)) { if ((CurFileEnt = - SourceMgr.getFileEntryForLoc(ISEntry.TheLexer->getFileLoc()))) + SourceMgr.getFileEntryForID(ISEntry.ThePPLexer->getFileID()))) if ((FE = HeaderInfo.LookupSubframeworkHeader(FilenameStart, FilenameEnd, CurFileEnt))) return FE; |