clang
6.0.0
|
#include "clang/Lex/PTHLexer.h"
Public Member Functions | |
PTHLexer (const PTHLexer &)=delete | |
PTHLexer & | operator= (const PTHLexer &)=delete |
~PTHLexer () override=default | |
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... | |
![]() | |
PreprocessorLexer (const PreprocessorLexer &)=delete | |
PreprocessorLexer & | operator= (const PreprocessorLexer &)=delete |
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 |
void | setConditionalLevels (ArrayRef< PPConditionalInfo > CL) |
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 () | |
PreprocessorLexer (Preprocessor *pp, FileID fid) | |
virtual | ~PreprocessorLexer ()=default |
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 | |
![]() | |
using | conditional_iterator = SmallVectorImpl< PPConditionalInfo >::const_iterator |
Iterator that traverses the current stack of preprocessor conditional directives (#if/#ifdef/#ifndef). More... | |
![]() | |
Preprocessor * | PP = nullptr |
const FileID | FID |
The SourceManager FileID corresponding to the file being lexed. More... | |
unsigned | InitialNumSLocEntries = 0 |
Number of SLocEntries before lexing the file. More... | |
bool | ParsingPreprocessorDirective = false |
True when parsing #XXX; turns '\n' into a tok::eod token. More... | |
bool | ParsingFilename = false |
True after #include; turns <xx> into a tok::angle_string_literal token. More... | |
bool | LexingRawMode = false |
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 27 of file PTHLexer.h.
|
protected |
Create a PTHLexer for the specified token stream.
Definition at line 49 of file PTHLexer.cpp.
References clang::SourceManager::getLocForStartOfFile(), and clang::Preprocessor::getSourceManager().
|
delete |
|
overridedefault |
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 170 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 165 of file PTHLexer.cpp.
References clang::comments::tok::eof.
|
overridevirtual |
getSourceLocation - Return a source location for the token in the current file.
Implements clang::PreprocessorLexer.
Definition at line 298 of file PTHLexer.cpp.
References clang::serialization::ComputeHash(), clang::SourceLocation::getLocWithOffset(), and StoredTokenSize.
Referenced by IndirectLex().
|
inlineoverridevirtual |
IndirectLex - An indirect call to 'Lex' that can be invoked via the PreprocessorLexer interface.
Implements clang::PreprocessorLexer.
Definition at line 95 of file PTHLexer.h.
References getSourceLocation(), Lex(), and SkipBlock().
|
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 84 of file PTHLexer.h.
References clang::comments::tok::eof.
Lex - Return the next token.
Definition at line 56 of file PTHLexer.cpp.
References clang::PreprocessorLexer::ConditionalStack, clang::Preprocessor::Diag(), clang::comments::tok::eof, clang::Preprocessor::getCodeCompletionFileLoc(), clang::IdentifierInfo::getTokenID(), clang::Preprocessor::HandleDirective(), clang::Preprocessor::HandleEndOfFile(), 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::Result, clang::Token::setFlag(), clang::Token::setIdentifierInfo(), clang::Token::setKind(), clang::Token::setLength(), clang::Token::setLiteralData(), clang::Token::setLocation(), clang::Token::startToken(), StoredTokenSize, and clang::format::Tok.
Referenced by IndirectLex().
bool PTHLexer::SkipBlock | ( | ) |
SkipBlock - Used by Preprocessor to skip the current conditional block.
Definition at line 199 of file PTHLexer.cpp.
References StoredTokenSize.
Referenced by IndirectLex().
|
friend |
Definition at line 61 of file PTHLexer.h.
Referenced by clang::PTHManager::Create().