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

#include <PTHLexer.h>

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

Public Member Functions

 ~PTHLexer () override
 
bool Lex (Token &Tok)
 Lex - Return the next token. More...
 
void getEOF (Token &Tok)
 
void DiscardToEndOfLine ()
 
unsigned isNextPPTokenLParen ()
 
void IndirectLex (Token &Result) override
 
SourceLocation getSourceLocation () override
 
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
 
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...
 
- 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)
 
void pushConditionalLevel (const PPConditionalInfo &CI)
 
bool popConditionalLevel (PPConditionalInfo &CI)
 
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 ( 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 37 of file PTHLexer.cpp.

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

clang::PTHLexer::~PTHLexer ( )
inlineoverride

Definition at line 67 of file PTHLexer.h.

Member Function Documentation

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, p, clang::PreprocessorLexer::ParsingFilename, clang::PreprocessorLexer::ParsingPreprocessorDirective, clang::Token::StartOfLine, StoredTokenSize, and y.

void PTHLexer::getEOF ( Token Tok)

Definition at line 154 of file PTHLexer.cpp.

References clang::comments::tok::eof, and clang::Token::is().

SourceLocation PTHLexer::getSourceLocation ( )
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.

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 Lex().

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.

bool PTHLexer::Lex ( Token Tok)
bool PTHLexer::SkipBlock ( )

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

Definition at line 188 of file PTHLexer.cpp.

References StoredTokenSize.

Friends And Related Function Documentation

friend class PTHManager
friend

Definition at line 61 of file PTHLexer.h.


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