clang  6.0.0svn
Public Member Functions | Protected Member Functions | Friends | List of all members
clang::PTHLexer Class Reference

#include "clang/Lex/PTHLexer.h"

Inheritance diagram for clang::PTHLexer:
Inheritance graph
[legend]
Collaboration diagram for clang::PTHLexer:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from clang::PreprocessorLexer
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...
 
PreprocessorgetPP () const
 Return the preprocessor object for this lexer. More...
 
FileID getFileID () const
 
unsigned getInitialNumSLocEntries () const
 Number of SLocEntries before lexing the file. More...
 
const FileEntrygetFileEntry () 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...
 
- Protected Member Functions inherited from clang::PreprocessorLexer
 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...
 
PPConditionalInfopeekConditionalLevel ()
 Return the top of the conditional stack. More...
 
unsigned getConditionalStackDepth () const
 

Friends

class PTHManager
 

Additional Inherited Members

- Public Types inherited from clang::PreprocessorLexer
typedef SmallVectorImpl< PPConditionalInfo >::const_iterator conditional_iterator
 Iterator that traverses the current stack of preprocessor conditional directives (#if/#ifdef/#ifndef). More...
 
- Protected Attributes inherited from clang::PreprocessorLexer
PreprocessorPP
 
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...
 

Detailed Description

Definition at line 24 of file PTHLexer.h.

Constructor & Destructor Documentation

◆ PTHLexer()

PTHLexer::PTHLexer ( Preprocessor pp,
FileID  FID,
const unsigned char *  D,
const unsigned char *  ppcond,
PTHManager PM 
)
protected

Create a PTHLexer for the specified token stream.

Definition at line 36 of file PTHLexer.cpp.

References clang::SourceManager::getLocForStartOfFile(), and clang::Preprocessor::getSourceManager().

◆ ~PTHLexer()

clang::PTHLexer::~PTHLexer ( )
inlineoverride

Definition at line 67 of file PTHLexer.h.

References DiscardToEndOfLine(), getEOF(), Lex(), and clang::format::Tok.

Member Function Documentation

◆ DiscardToEndOfLine()

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 158 of file PTHLexer.cpp.

References clang::comments::tok::eof, clang::PreprocessorLexer::ParsingFilename, clang::PreprocessorLexer::ParsingPreprocessorDirective, clang::Token::StartOfLine, and StoredTokenSize.

Referenced by ~PTHLexer().

◆ getEOF()

void PTHLexer::getEOF ( Token Tok)

Definition at line 153 of file PTHLexer.cpp.

References clang::comments::tok::eof.

Referenced by ~PTHLexer().

◆ getSourceLocation()

SourceLocation PTHLexer::getSourceLocation ( )
overridevirtual

getSourceLocation - Return a source location for the token in the current file.

Implements clang::PreprocessorLexer.

Definition at line 285 of file PTHLexer.cpp.

References clang::serialization::ComputeHash(), clang::SourceLocation::getLocWithOffset(), and StoredTokenSize.

Referenced by IndirectLex().

◆ IndirectLex()

void clang::PTHLexer::IndirectLex ( Token Result)
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 getSourceLocation(), Lex(), and SkipBlock().

◆ isNextPPTokenLParen()

unsigned clang::PTHLexer::isNextPPTokenLParen ( )
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()

bool PTHLexer::Lex ( Token Tok)

◆ SkipBlock()

bool PTHLexer::SkipBlock ( )

SkipBlock - Used by Preprocessor to skip the current conditional block.

Definition at line 187 of file PTHLexer.cpp.

References StoredTokenSize.

Referenced by IndirectLex().

Friends And Related Function Documentation

◆ PTHManager

friend class PTHManager
friend

Definition at line 61 of file PTHLexer.h.

Referenced by clang::PTHManager::Create().


The documentation for this class was generated from the following files: