13#ifndef LLVM_CLANG_LEX_TOKENLEXER_H
14#define LLVM_CLANG_LEX_TOKENLEXER_H
17#include "llvm/ADT/ArrayRef.h"
25class VAOptExpansionContext;
68 unsigned MacroStartSLocOffset;
74 unsigned MacroDefLength;
78 bool AtStartOfLine : 1;
79 bool HasLeadingSpace : 1;
87 bool NextTokGetsSpace : 1;
97 bool DisableMacroExpansion : 1;
110 : PP(pp), OwnsTokens(
false) {
111 Init(Tok, ILEnd, MI, ActualArgs);
119 : PP(pp), OwnsTokens(
false) {
120 Init(TokArray, NumToks, DisableExpansion, ownsTokens, isReinject);
139 void Init(
const Token *TokArray,
unsigned NumToks,
bool DisableMacroExpansion,
140 bool OwnsTokens,
bool IsReinject);
159 bool isAtEnd()
const {
160 return CurTokenIdx == NumTokens;
184 bool pasteTokens(Token &LHSTok, ArrayRef<Token> TokenStream,
185 unsigned int &CurIdx);
189 bool pasteTokens(Token &Tok);
205 void stringifyVAOPTContents(SmallVectorImpl<Token> &ResultToks,
206 const VAOptExpansionContext &VCtx,
207 SourceLocation VAOPTClosingParenLoc);
211 void ExpandFunctionArguments();
218 void HandleMicrosoftCommentPaste(Token &Tok, SourceLocation OpLoc);
223 SourceLocation getExpansionLocForMacroDefLoc(SourceLocation loc)
const;
230 void updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc,
231 Token *begin_tokens, Token *end_tokens);
235 bool MaybeRemoveCommaBeforeVaArgs(SmallVectorImpl<Token> &ResultToks,
236 bool HasPasteOperator,
237 MacroInfo *Macro,
unsigned MacroArgNo,
240 void PropagateLineStartLeadingSpaceInfo(Token &
Result);
Defines the clang::SourceLocation class and associated facilities.
MacroArgs - An instance of this class captures information about the formal arguments specified to a ...
Encapsulates the data about a macro definition (e.g.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Encodes a location in the source.
TokenLexer - This implements a lexer that returns tokens from a macro body or token stream instead of...
friend class Preprocessor
bool isParsingPreprocessorDirective() const
isParsingPreprocessorDirective - Return true if we are in the middle of a preprocessor directive.
unsigned isNextTokenLParen() const
If the next token lexed will pop this macro off the expansion stack, return 2.
TokenLexer(Token &Tok, SourceLocation ILEnd, MacroInfo *MI, MacroArgs *ActualArgs, Preprocessor &pp)
Create a TokenLexer for the specified macro with the specified actual arguments.
TokenLexer(const TokenLexer &)=delete
bool Lex(Token &Tok)
Lex and return a token from this macro stream.
TokenLexer(const Token *TokArray, unsigned NumToks, bool DisableExpansion, bool ownsTokens, bool isReinject, Preprocessor &pp)
Create a TokenLexer for the specified token stream.
TokenLexer & operator=(const TokenLexer &)=delete
Token - This structure provides full information about a lexed token.
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.