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");
Defines interfaces for clang::FileEntry and clang::FileEntryRef.
Defines the MultipleIncludeOpt interface.
Defines the clang::SourceLocation class and associated facilities.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multipl...
conditional_iterator conditional_begin() const
unsigned getInitialNumSLocEntries() const
Number of SLocEntries before lexing the file.
virtual void IndirectLex(Token &Result)=0
conditional_iterator conditional_end() const
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...
unsigned getConditionalStackDepth() const
bool LexingRawMode
True if in raw mode.
PreprocessorLexer(const PreprocessorLexer &)=delete
virtual ~PreprocessorLexer()=default
void setParsingPreprocessorDirective(bool f)
Inform the lexer whether or not we are currently lexing a preprocessor directive.
SmallVector< PPConditionalInfo, 4 > ConditionalStack
Information about the set of #if/#ifdef/#ifndef blocks we are currently in.
bool ParsingPreprocessorDirective
True when parsing #XXX; turns '\n' into a tok::eod token.
void pushConditionalLevel(const PPConditionalInfo &CI)
MultipleIncludeOpt MIOpt
A state machine that detects the #ifndef-wrapping a file idiom for the multiple-include optimization.
void setConditionalLevels(ArrayRef< PPConditionalInfo > CL)
PreprocessorLexer & operator=(const PreprocessorLexer &)=delete
bool popConditionalLevel(PPConditionalInfo &CI)
popConditionalLevel - Remove an entry off the top of the conditional stack, returning information abo...
bool ParsingFilename
True after #include; turns <xx> or "xxx" into a tok::header_name token.
OptionalFileEntryRef getFileEntry() const
getFileEntry - Return the FileEntry corresponding to this FileID.
void LexIncludeFilename(Token &FilenameTok)
Lex a token, producing a header-name token if possible.
bool isLexingRawMode() const
Return true if this lexer is in raw mode or not.
PPConditionalInfo & peekConditionalLevel()
Return the top of the conditional stack.
unsigned InitialNumSLocEntries
Number of SLocEntries before lexing the file.
Preprocessor * getPP() const
Return the preprocessor object for this lexer.
virtual SourceLocation getSourceLocation()=0
Return the source location for the next observable location.
const FileID FID
The SourceManager FileID corresponding to the file being lexed.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Encodes a location in the source.
Token - This structure provides full information about a lexed token.
The JSON file list parser is used to communicate input to InstallAPI.
Information about the conditional stack (#if directives) currently active.
bool FoundNonSkip
True if we have emitted tokens already, and now we're in an #else block or something.
SourceLocation IfLoc
Location where the conditional started.
bool WasSkipping
True if this was contained in a skipping directive, e.g., in a "\#if 0" block.
bool FoundElse
True if we've seen a #else in this block.