clang
3.9.0
|
#include <PTHLexer.h>
Public Member Functions | |
~PTHLexer () override | |
bool | Lex (Token &Tok) |
Lex - Return the next token. More... | |
void | getEOF (Token &Tok) |
void | DiscardToEndOfLine () |
DiscardToEndOfLine - Read the rest of the current preprocessor line as an uninterpreted string. More... | |
unsigned | isNextPPTokenLParen () |
isNextPPTokenLParen - Return 1 if the next unexpanded token will return a tok::l_paren token, 0 if it is something else and 2 if there are no more tokens controlled by this lexer. More... | |
void | IndirectLex (Token &Result) override |
IndirectLex - An indirect call to 'Lex' that can be invoked via the PreprocessorLexer interface. More... | |
SourceLocation | getSourceLocation () override |
getSourceLocation - Return a source location for the token in the current file. More... | |
bool | SkipBlock () |
SkipBlock - Used by Preprocessor to skip the current conditional block. More... | |
![]() | |
void | LexIncludeFilename (Token &Result) |
After the preprocessor has parsed a #include, lex and (potentially) macro expand the filename. More... | |
void | setParsingPreprocessorDirective (bool f) |
Inform the lexer whether or not we are currently lexing a preprocessor directive. More... | |
bool | isLexingRawMode () const |
Return true if this lexer is in raw mode or not. More... | |
Preprocessor * | getPP () const |
Return the preprocessor object for this lexer. More... | |
FileID | getFileID () const |
unsigned | getInitialNumSLocEntries () const |
Number of SLocEntries before lexing the file. More... | |
const FileEntry * | getFileEntry () const |
getFileEntry - Return the FileEntry corresponding to this FileID. More... | |
conditional_iterator | conditional_begin () const |
conditional_iterator | conditional_end () const |
Protected Member Functions | |
PTHLexer (Preprocessor &pp, FileID FID, const unsigned char *D, const unsigned char *ppcond, PTHManager &PM) | |
Create a PTHLexer for the specified token stream. More... | |
![]() | |
PreprocessorLexer (const PreprocessorLexer &)=delete | |
void | operator= (const PreprocessorLexer &)=delete |
PreprocessorLexer (Preprocessor *pp, FileID fid) | |
PreprocessorLexer () | |
virtual | ~PreprocessorLexer () |
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 for diagnostic emission (e.g. More... | |
void | pushConditionalLevel (const PPConditionalInfo &CI) |
bool | popConditionalLevel (PPConditionalInfo &CI) |
popConditionalLevel - Remove an entry off the top of the conditional stack, returning information about it. More... | |
PPConditionalInfo & | peekConditionalLevel () |
Return the top of the conditional stack. More... | |
unsigned | getConditionalStackDepth () const |
Friends | |
class | PTHManager |
Additional Inherited Members | |
![]() | |
typedef SmallVectorImpl < PPConditionalInfo > ::const_iterator | conditional_iterator |
Iterator that traverses the current stack of preprocessor conditional directives (#if/#ifdef/#ifndef). More... | |
![]() | |
Preprocessor * | PP |
const FileID | FID |
The SourceManager FileID corresponding to the file being lexed. More... | |
unsigned | InitialNumSLocEntries |
Number of SLocEntries before lexing the file. More... | |
bool | ParsingPreprocessorDirective |
True when parsing #XXX; turns '\n' into a tok::eod token. More... | |
bool | ParsingFilename |
True after #include; turns <xx> into a tok::angle_string_literal token. More... | |
bool | LexingRawMode |
True if in raw mode. More... | |
MultipleIncludeOpt | MIOpt |
A state machine that detects the #ifndef-wrapping a file idiom for the multiple-include optimization. More... | |
SmallVector< PPConditionalInfo, 4 > | ConditionalStack |
Information about the set of #if/#ifdef/#ifndef blocks we are currently in. More... | |
Definition at line 24 of file PTHLexer.h.
|
protected |
Create a PTHLexer for the specified token stream.
Definition at line 37 of file PTHLexer.cpp.
References clang::SourceManager::getLocForStartOfFile(), and clang::Preprocessor::getSourceManager().
|
inlineoverride |
Definition at line 67 of file PTHLexer.h.
void PTHLexer::DiscardToEndOfLine | ( | ) |
DiscardToEndOfLine - Read the rest of the current preprocessor line as an uninterpreted string.
This switches the lexer out of directive mode.
Definition at line 159 of file PTHLexer.cpp.
References clang::comments::tok::eof, clang::PreprocessorLexer::ParsingFilename, clang::PreprocessorLexer::ParsingPreprocessorDirective, clang::Token::StartOfLine, and StoredTokenSize.
void PTHLexer::getEOF | ( | Token & | Tok | ) |
Definition at line 154 of file PTHLexer.cpp.
References clang::comments::tok::eof, and clang::Token::is().
|
overridevirtual |
getSourceLocation - Return a source location for the token in the current file.
Implements clang::PreprocessorLexer.
Definition at line 286 of file PTHLexer.cpp.
References clang::SourceLocation::getLocWithOffset(), and StoredTokenSize.
|
inlineoverridevirtual |
IndirectLex - An indirect call to 'Lex' that can be invoked via the PreprocessorLexer interface.
Implements clang::PreprocessorLexer.
Definition at line 92 of file PTHLexer.h.
References Lex().
|
inline |
isNextPPTokenLParen - Return 1 if the next unexpanded token will return a tok::l_paren token, 0 if it is something else and 2 if there are no more tokens controlled by this lexer.
Definition at line 81 of file PTHLexer.h.
References clang::comments::tok::eof.
Lex - Return the next token.
Definition at line 45 of file PTHLexer.cpp.
References clang::comments::tok::eof, clang::IdentifierInfo::getTokenID(), clang::Preprocessor::HandleDirective(), clang::Preprocessor::HandleIdentifier(), clang::Token::isAtStartOfLine(), clang::IdentifierInfo::isHandleIdentifierCase(), clang::Token::isLiteral(), clang::PreprocessorLexer::LexingRawMode, clang::PreprocessorLexer::MIOpt, clang::PreprocessorLexer::ParsingPreprocessorDirective, clang::PreprocessorLexer::PP, clang::MultipleIncludeOpt::ReadToken(), clang::Token::setFlag(), clang::Token::setIdentifierInfo(), clang::Token::setKind(), clang::Token::setLength(), clang::Token::setLiteralData(), clang::Token::setLocation(), clang::Token::startToken(), and StoredTokenSize.
Referenced by IndirectLex().
bool PTHLexer::SkipBlock | ( | ) |
SkipBlock - Used by Preprocessor to skip the current conditional block.
Definition at line 188 of file PTHLexer.cpp.
References StoredTokenSize.
|
friend |
Definition at line 61 of file PTHLexer.h.