- 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59666 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/Lexer.cpp b/lib/Lex/Lexer.cpp
index 8ddd62f..eebdd1e 100644
--- a/lib/Lex/Lexer.cpp
+++ b/lib/Lex/Lexer.cpp
@@ -63,7 +63,8 @@
/// outlive it, so it doesn't take ownership of either of them.
Lexer::Lexer(SourceLocation fileloc, Preprocessor &pp,
const char *BufStart, const char *BufEnd)
- : PreprocessorLexer(&pp), FileLoc(fileloc), Features(pp.getLangOptions()) {
+ : PreprocessorLexer(&pp, fileloc), FileLoc(fileloc),
+ Features(pp.getLangOptions()) {
SourceManager &SourceMgr = PP->getSourceManager();
unsigned InputFileID = SourceMgr.getPhysicalLoc(FileLoc).getFileID();
@@ -110,7 +111,9 @@
Lexer::Lexer(SourceLocation fileloc, const LangOptions &features,
const char *BufStart, const char *BufEnd,
const llvm::MemoryBuffer *FromFile)
- : PreprocessorLexer(0), FileLoc(fileloc), Features(features) {
+ : PreprocessorLexer(), FileLoc(fileloc),
+ Features(features) {
+
Is_PragmaLexer = false;
InitCharacterInfo();