13#ifndef LLVM_CLANG_LEX_TOKENLEXER_H
14#define LLVM_CLANG_LEX_TOKENLEXER_H
17#include "llvm/ADT/ArrayRef.h"
74 unsigned MacroDefLength;
78 bool AtStartOfLine : 1;
79 bool HasLeadingSpace : 1;
87 bool NextTokGetsSpace : 1;
97 bool DisableMacroExpansion : 1;
105 bool LexingCXXModuleDirective : 1;
114 : PP(pp), OwnsTokens(
false) {
115 Init(
Tok, ILEnd, MI, ActualArgs);
123 : PP(pp), OwnsTokens(
false) {
124 Init(TokArray, NumToks, DisableExpansion, ownsTokens, isReinject);
143 void Init(
const Token *TokArray,
unsigned NumToks,
bool DisableMacroExpansion,
144 bool OwnsTokens,
bool IsReinject);
171 bool isAtEnd()
const {
172 return CurTokenIdx == NumTokens;
197 unsigned int &CurIdx);
201 bool pasteTokens(Token &
Tok);
217 void stringifyVAOPTContents(SmallVectorImpl<Token> &ResultToks,
218 const VAOptExpansionContext &VCtx,
219 SourceLocation VAOPTClosingParenLoc);
223 void ExpandFunctionArguments();
230 void HandleMicrosoftCommentPaste(Token &
Tok, SourceLocation OpLoc);
235 SourceLocation getExpansionLocForMacroDefLoc(SourceLocation loc)
const;
242 void updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc,
243 Token *begin_tokens, Token *end_tokens);
247 bool MaybeRemoveCommaBeforeVaArgs(SmallVectorImpl<Token> &ResultToks,
248 bool HasPasteOperator,
249 MacroInfo *
Macro,
unsigned MacroArgNo,
252 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.
friend class Preprocessor
bool isParsingPreprocessorDirective() const
isParsingPreprocessorDirective - Return true if we are in the middle of a preprocessor directive.
bool isLexingCXXModuleDirective() const
isLexingCXXModuleDirective - Return true if we are lexing a C++ module or import directive.
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.
std::optional< Token > peekNextPPToken() const
If TokenLexer::isAtEnd returns true(the next token lexed will pop thismacro off the expansion stack),...
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
void setLexingCXXModuleDirective(bool Val=true)
setLexingCXXModuleDirective - This is set to true if this TokenLexer is created when handling a C++ m...
Token - This structure provides full information about a lexed token.
A class for tracking whether we're inside a VA_OPT during a traversal of the tokens of a macro during...
The JSON file list parser is used to communicate input to InstallAPI.