Go to the documentation of this file.
14 #ifndef LLVM_CLANG_LEX_PREPROCESSORLEXER_H
15 #define LLVM_CLANG_LEX_PREPROCESSORLEXER_H
21 #include "llvm/ADT/ArrayRef.h"
22 #include "llvm/ADT/SmallVector.h"
31 virtual void anchor();
94 bool FoundNonSkip,
bool FoundElse) {
96 CI.
IfLoc = DirectiveStart;
149 "PreprocessorLexer::getFileID() should only be used with a Preprocessor");
183 #endif // LLVM_CLANG_LEX_PREPROCESSORLEXER_H
OptionalFileEntryRefDegradesToFileEntryPtr getFileEntry() const
getFileEntry - Return the FileEntry corresponding to this FileID.
unsigned getConditionalStackDepth() const
Encodes a location in the source.
void pushConditionalLevel(const PPConditionalInfo &CI)
SmallVector< PPConditionalInfo, 4 > ConditionalStack
Information about the set of #if/#ifdef/#ifndef blocks we are currently in.
void setConditionalLevels(ArrayRef< PPConditionalInfo > CL)
virtual void IndirectLex(Token &Result)=0
MultipleIncludeOpt MIOpt
A state machine that detects the #ifndef-wrapping a file idiom for the multiple-include optimization.
bool ParsingFilename
True after #include; turns <xx> or "xxx" into a tok::header_name token.
unsigned getInitialNumSLocEntries() const
Number of SLocEntries before lexing the file.
SmallVectorImpl< PPConditionalInfo >::const_iterator conditional_iterator
Iterator that traverses the current stack of preprocessor conditional directives (#if/#ifdef/#ifndef)...
void pushConditionalLevel(SourceLocation DirectiveStart, bool WasSkipping, bool FoundNonSkip, bool FoundElse)
pushConditionalLevel - When we enter a #if directive, this keeps track of what we are currently in fo...
conditional_iterator conditional_begin() const
Wrapper around Optional<FileEntryRef> that degrades to 'const FileEntry*', facilitating incremental p...
bool LexingRawMode
True if in raw mode.
Token - This structure provides full information about a lexed token.
bool FoundElse
True if we've seen a #else in this block.
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multipl...
void LexIncludeFilename(Token &FilenameTok)
Lex a token, producing a header-name token if possible.
Preprocessor * getPP() const
Return the preprocessor object for this lexer.
virtual ~PreprocessorLexer()=default
PPConditionalInfo & peekConditionalLevel()
Return the top of the conditional stack.
Information about the conditional stack (#if directives) currently active.
bool ParsingPreprocessorDirective
True when parsing #XXX; turns '\n' into a tok::eod token.
const FileID FID
The SourceManager FileID corresponding to the file being lexed.
bool popConditionalLevel(PPConditionalInfo &CI)
popConditionalLevel - Remove an entry off the top of the conditional stack, returning information abo...
bool isLexingRawMode() const
Return true if this lexer is in raw mode or not.
void setParsingPreprocessorDirective(bool f)
Inform the lexer whether or not we are currently lexing a preprocessor directive.
PreprocessorLexer & operator=(const PreprocessorLexer &)=delete
bool WasSkipping
True if this was contained in a skipping directive, e.g., in a "\#if 0" block.
unsigned InitialNumSLocEntries
Number of SLocEntries before lexing the file.
virtual SourceLocation getSourceLocation()=0
Return the source location for the next observable location.
SourceLocation IfLoc
Location where the conditional started.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
bool FoundNonSkip
True if we have emitted tokens already, and now we're in an #else block or something.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
conditional_iterator conditional_end() const