15 #ifndef LLVM_CLANG_LEX_PREPROCESSORLEXER_H
16 #define LLVM_CLANG_LEX_PREPROCESSORLEXER_H
20 #include "llvm/ADT/SmallVector.h"
28 virtual void anchor();
98 bool FoundNonSkip,
bool FoundElse) {
100 CI.
IfLoc = DirectiveStart;
155 "PreprocessorLexer::getFileID() should only be used with a Preprocessor");
unsigned getInitialNumSLocEntries() const
Number of SLocEntries before lexing the file.
conditional_iterator conditional_begin() const
PPConditionalInfo & peekConditionalLevel()
Return the top of the conditional stack.
unsigned InitialNumSLocEntries
Number of SLocEntries before lexing the file.
void operator=(const PreprocessorLexer &)=delete
void pushConditionalLevel(SourceLocation DirectiveStart, bool WasSkipping, bool FoundNonSkip, bool FoundElse)
Defines the MultipleIncludeOpt interface.
bool ParsingPreprocessorDirective
True when parsing #XXX; turns '\n' into a tok::eod token.
SmallVector< PPConditionalInfo, 4 > ConditionalStack
Information about the set of #if/#ifdef/#ifndef blocks we are currently in.
conditional_iterator conditional_end() const
bool popConditionalLevel(PPConditionalInfo &CI)
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multipl...
void setParsingPreprocessorDirective(bool f)
Inform the lexer whether or not we are currently lexing a preprocessor directive. ...
SmallVectorImpl< PPConditionalInfo >::const_iterator conditional_iterator
Iterator that traverses the current stack of preprocessor conditional directives (#if/#ifdef/#ifndef)...
bool FoundNonSkip
True if we have emitted tokens already, and now we're in an #else block or something. Only useful in Skipping blocks.
const FileID FID
The SourceManager FileID corresponding to the file being lexed.
const FileEntry * getFileEntry() const
bool ParsingFilename
True after #include; turns <xx> into a tok::angle_string_literal token.
bool LexingRawMode
True if in raw mode.
void pushConditionalLevel(const PPConditionalInfo &CI)
MultipleIncludeOpt MIOpt
A state machine that detects the #ifndef-wrapping a file idiom for the multiple-include optimization...
Information about the conditional stack (#if directives) currently active.
The result type of a method or function.
virtual SourceLocation getSourceLocation()=0
Return the source location for the next observable location.
bool WasSkipping
True if this was contained in a skipping directive, e.g., in a "\#if 0" block.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
Cached information about one file (either on disk or in the virtual file system). ...
unsigned getConditionalStackDepth() const
SourceLocation IfLoc
Location where the conditional started.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Preprocessor * getPP() const
Return the preprocessor object for this lexer.
virtual ~PreprocessorLexer()
void LexIncludeFilename(Token &Result)
After the preprocessor has parsed a #include, lex and (potentially) macro expand the filename...
bool isLexingRawMode() const
Return true if this lexer is in raw mode or not.
virtual void IndirectLex(Token &Result)=0
bool FoundElse
True if we've seen a #else in this block. If so, #elif/#else directives are not allowed.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.