14 #ifndef LLVM_CLANG_LEX_TOKENLEXER_H
15 #define LLVM_CLANG_LEX_TOKENLEXER_H
72 unsigned MacroStartSLocOffset;
77 unsigned MacroDefLength;
81 bool AtStartOfLine : 1;
82 bool HasLeadingSpace : 1;
90 bool NextTokGetsSpace : 1;
100 bool DisableMacroExpansion : 1;
111 : Macro(nullptr), ActualArgs(nullptr), PP(pp), OwnsTokens(
false) {
112 Init(Tok, ILEnd, MI, ActualArgs);
127 : Macro(nullptr), ActualArgs(nullptr), PP(pp), OwnsTokens(
false) {
128 Init(TokArray, NumToks, DisableExpansion, ownsTokens);
136 void Init(
const Token *TokArray,
unsigned NumToks,
137 bool DisableMacroExpansion,
bool OwnsTokens);
158 bool isAtEnd()
const {
159 return CurToken == NumTokens;
167 bool PasteTokens(
Token &Tok);
171 void ExpandFunctionArguments();
178 void HandleMicrosoftCommentPaste(
Token &Tok, SourceLocation OpLoc);
183 SourceLocation getExpansionLocForMacroDefLoc(SourceLocation loc)
const;
190 void updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc,
195 bool MaybeRemoveCommaBeforeVaArgs(SmallVectorImpl<Token> &ResultToks,
196 bool HasPasteOperator,
197 MacroInfo *Macro,
unsigned MacroArgNo,
200 void PropagateLineStartLeadingSpaceInfo(
Token &
Result);
void Init(Token &Tok, SourceLocation ILEnd, MacroInfo *MI, MacroArgs *ActualArgs)
Init - Initialize this TokenLexer to expand from the specified macro with the specified argument info...
unsigned isNextTokenLParen() const
isNextTokenLParen - If the next token lexed will pop this macro off the expansion stack...
bool isParsingPreprocessorDirective() const
isParsingPreprocessorDirective - Return true if we are in the middle of a preprocessor directive...
Token - This structure provides full information about a lexed token.
friend class Preprocessor
bool Lex(Token &Tok)
Lex - Lex and return a token from this macro stream.
TokenLexer - This implements a lexer that returns tokens from a macro body or token stream instead of...
TokenLexer(const Token *TokArray, unsigned NumToks, bool DisableExpansion, bool ownsTokens, Preprocessor &pp)
Create a TokenLexer for the specified token stream.
MacroArgs - An instance of this class captures information about the formal arguments specified to a ...
TokenLexer(Token &Tok, SourceLocation ILEnd, MacroInfo *MI, MacroArgs *ActualArgs, Preprocessor &pp)
Create a TokenLexer for the specified macro with the specified actual arguments.
The result type of a method or function.
Encodes a location in the source.
Encapsulates the data about a macro definition (e.g.
Defines the clang::SourceLocation class and associated facilities.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.