1f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===--- TokenLexer.h - Lex from a token buffer -----------------*- C++ -*-===// 2f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 3f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// The LLVM Compiler Infrastructure 4f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 5f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file is distributed under the University of Illinois Open Source 6f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// License. See LICENSE.TXT for details. 7f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 8f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===// 9f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 10f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// This file defines the TokenLexer interface. 11f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot// 12f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot//===----------------------------------------------------------------------===// 13f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 14f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#ifndef LLVM_CLANG_LEX_TOKENLEXER_H 15f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#define LLVM_CLANG_LEX_TOKENLEXER_H 16f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 17f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "clang/Basic/SourceLocation.h" 18f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#include "llvm/ADT/ArrayRef.h" 19f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 20f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotnamespace clang { 21f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class MacroInfo; 22f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Preprocessor; 23f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class Token; 24f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class MacroArgs; 25f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot class VAOptExpansionContext; 26f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 27f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// TokenLexer - This implements a lexer that returns tokens from a macro body 28f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// or token stream instead of lexing from a character buffer. This is used for 29f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// macro expansion and _Pragma handling, for example. 30f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot/// 31f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotclass TokenLexer { 32f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Macro - The macro we are expanding from. This is null if expanding a 33f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// token stream. 34f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 35f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot MacroInfo *Macro; 36f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 37f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// ActualArgs - The actual arguments specified for a function-like macro, or 38f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// null. The TokenLexer owns the pointed-to object. 39f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot MacroArgs *ActualArgs; 40f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 41f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// PP - The current preprocessor object we are expanding for. 42f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 43f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Preprocessor &PP; 44f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 45f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Tokens - This is the pointer to an array of tokens that the macro is 46f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// defined to, with arguments expanded for function-like macros. If this is 47f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// a token stream, these are the tokens we are returning. This points into 48f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the macro definition we are lexing from, a cache buffer that is owned by 49f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the preprocessor, or some other buffer that we may or may not own 50f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// (depending on OwnsTokens). 51f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Note that if it points into Preprocessor's cache buffer, the Preprocessor 52f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// may update the pointer as needed. 53f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const Token *Tokens; 54f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot friend class Preprocessor; 55f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 56f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// NumTokens - This is the length of the Tokens array. 57f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 58f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned NumTokens; 59f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 60f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// This is the index of the next token that Lex will return. 61f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 62f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned CurTokenIdx; 63f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 64f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// ExpandLocStart/End - The source location range where this macro was 65f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// expanded. 66f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation ExpandLocStart, ExpandLocEnd; 67f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 68f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Source location pointing at the source location entry chunk that 69f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// was reserved for the current macro expansion. 70f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation MacroExpansionStart; 71f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 72f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief The offset of the macro expansion in the 73f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// "source location address space". 74f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned MacroStartSLocOffset; 75f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 76f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Location of the macro definition. 77f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation MacroDefStart; 78f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Length of the macro definition. 79f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned MacroDefLength; 80f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 81f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Lexical information about the expansion point of the macro: the identifier 82f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// that the macro expanded from had these properties. 83f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool AtStartOfLine : 1; 84f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool HasLeadingSpace : 1; 85f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 86f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // NextTokGetsSpace - When this is true, the next token appended to the 87f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // output list during function argument expansion will get a leading space, 88f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // regardless of whether it had one to begin with or not. This is used for 89f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // placemarker support. If still true after function argument expansion, the 90f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // leading space will be applied to the first token following the macro 91f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot // expansion. 92f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool NextTokGetsSpace : 1; 93f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 94f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// OwnsTokens - This is true if this TokenLexer allocated the Tokens 95f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// array, and thus needs to free it when destroyed. For simple object-like 96f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// macros (for example) we just point into the token buffer of the macro 97f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// definition, we don't make a copy of it. 98f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool OwnsTokens : 1; 99f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 100f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// DisableMacroExpansion - This is true when tokens lexed from the TokenLexer 101f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// should not be subject to further macro expansion. 102f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool DisableMacroExpansion : 1; 103f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 104f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot TokenLexer(const TokenLexer &) = delete; 105f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void operator=(const TokenLexer &) = delete; 106f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotpublic: 107f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Create a TokenLexer for the specified macro with the specified actual 108f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// arguments. Note that this ctor takes ownership of the ActualArgs pointer. 109f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// ILEnd specifies the location of the ')' for a function-like macro or the 110f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// identifier for an object-like macro. 111f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot TokenLexer(Token &Tok, SourceLocation ILEnd, MacroInfo *MI, 112f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot MacroArgs *ActualArgs, Preprocessor &pp) 113f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Macro(nullptr), ActualArgs(nullptr), PP(pp), OwnsTokens(false) { 114f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Init(Tok, ILEnd, MI, ActualArgs); 115f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 116f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 117f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Init - Initialize this TokenLexer to expand from the specified macro 118f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// with the specified argument information. Note that this ctor takes 119f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// ownership of the ActualArgs pointer. ILEnd specifies the location of the 120f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// ')' for a function-like macro or the identifier for an object-like macro. 121f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void Init(Token &Tok, SourceLocation ILEnd, MacroInfo *MI, 122f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot MacroArgs *ActualArgs); 123f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 124f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Create a TokenLexer for the specified token stream. If 'OwnsTokens' is 125f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// specified, this takes ownership of the tokens and delete[]'s them when 126f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the token lexer is empty. 127f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot TokenLexer(const Token *TokArray, unsigned NumToks, bool DisableExpansion, 128f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool ownsTokens, Preprocessor &pp) 129f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot : Macro(nullptr), ActualArgs(nullptr), PP(pp), OwnsTokens(false) { 130f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Init(TokArray, NumToks, DisableExpansion, ownsTokens); 131f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 132f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 133f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Init - Initialize this TokenLexer with the specified token stream. 134f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// This does not take ownership of the specified token vector. 135f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 136f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// DisableExpansion is true when macro expansion of tokens lexed from this 137f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// stream should be disabled. 138f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void Init(const Token *TokArray, unsigned NumToks, 139f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool DisableMacroExpansion, bool OwnsTokens); 140f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 141f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot ~TokenLexer() { destroy(); } 142f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 143f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// isNextTokenLParen - If the next token lexed will pop this macro off the 144f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// expansion stack, return 2. If the next unexpanded token is a '(', return 145f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 1, otherwise return 0. 146f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned isNextTokenLParen() const; 147f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 148f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Lex - Lex and return a token from this macro stream. 149f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool Lex(Token &Tok); 150f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 151f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// isParsingPreprocessorDirective - Return true if we are in the middle of a 152f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// preprocessor directive. 153f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isParsingPreprocessorDirective() const; 154f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 155f3014761c955345d6e05491608e73228d014afbandroid-build-team Robotprivate: 156f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void destroy(); 157f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 158f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// isAtEnd - Return true if the next lex call will pop this macro off the 159f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// include stack. 160f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool isAtEnd() const { 161f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot return CurTokenIdx == NumTokens; 162f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot } 163f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 164f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Concatenates the next (sub-)sequence of \p Tokens separated by '##' 165f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// starting with LHSTok - stopping when we encounter a token that is neither 166f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// '##' nor preceded by '##'. Places the result back into \p LHSTok and sets 167f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \p CurIdx to point to the token following the last one that was pasted. 168f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 169f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Also performs the MSVC extension wide-literal token pasting involved with: 170f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \code L #macro-arg. \endcode 171f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 172f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param[in,out] LHSTok - Contains the token to the left of '##' in \p 173f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Tokens upon entry and will contain the resulting concatenated Token upon 174f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// exit. 175f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 176f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param[in] TokenStream - The stream of Tokens we are lexing from. 177f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 178f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param[in,out] CurIdx - Upon entry, \pTokens[\pCurIdx] must equal '##' 179f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// (with the exception of the MSVC extension mentioned above). Upon exit, it 180f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// is set to the index of the token following the last token that was 181f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// concatenated together. 182f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 183f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \returns If this returns true, the caller should immediately return the 184f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// token. 185f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 186f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool pasteTokens(Token &LHSTok, ArrayRef<Token> TokenStream, 187f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot unsigned int &CurIdx); 188f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 189f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Calls pasteTokens above, passing in the '*this' object's Tokens and 190f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// CurTokenIdx data members. 191f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool pasteTokens(Token &Tok); 192f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 193f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 194f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Takes the tail sequence of tokens within ReplacementToks that represent 195f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the just expanded __VA_OPT__ tokens (possibly zero tokens) and transforms 196f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// them into a string. \p VCtx is used to determine which token represents 197f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the first __VA_OPT__ replacement token. 198f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 199f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param[in,out] ReplacementToks - Contains the current Replacement Tokens 200f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// (prior to rescanning and token pasting), the tail end of which represents 201f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// the tokens just expanded through __VA_OPT__ processing. These (sub) 202f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// sequence of tokens are folded into one stringified token. 203f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 204f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param[in] VCtx - contains relevent contextual information about the 205f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// state of the tokens around and including the __VA_OPT__ token, necessary 206f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// for stringification. 207f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 208f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void stringifyVAOPTContents(SmallVectorImpl<Token> &ReplacementToks, 209f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot const VAOptExpansionContext &VCtx, 210f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation VAOPTClosingParenLoc); 211f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 212f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Expand the arguments of a function-like macro so that we can quickly 213f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// return preexpanded tokens from Tokens. 214f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void ExpandFunctionArguments(); 215f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 216f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// HandleMicrosoftCommentPaste - In microsoft compatibility mode, /##/ pastes 217f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// together to form a comment that comments out everything in the current 218f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// macro, other active macros, and anything left on the current physical 219f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// source line of the expanded buffer. Handle this by returning the 220f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// first token on the next line. 221f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void HandleMicrosoftCommentPaste(Token &Tok, SourceLocation OpLoc); 222f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 223f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief If \p loc is a FileID and points inside the current macro 224f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// definition, returns the appropriate source location pointing at the 225f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// macro expansion source location entry. 226f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot SourceLocation getExpansionLocForMacroDefLoc(SourceLocation loc) const; 227f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 228f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \brief Creates SLocEntries and updates the locations of macro argument 229f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// tokens to their new expanded locations. 230f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// 231f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// \param ArgIdSpellLoc the location of the macro argument id inside the 232f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// macro definition. 233f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void updateLocForMacroArgTokens(SourceLocation ArgIdSpellLoc, 234f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Token *begin_tokens, Token *end_tokens); 235f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 236f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// Remove comma ahead of __VA_ARGS__, if present, according to compiler 237f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot /// dialect settings. Returns true if the comma is removed. 238f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool MaybeRemoveCommaBeforeVaArgs(SmallVectorImpl<Token> &ResultToks, 239f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot bool HasPasteOperator, 240f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot MacroInfo *Macro, unsigned MacroArgNo, 241f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot Preprocessor &PP); 242f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 243f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot void PropagateLineStartLeadingSpaceInfo(Token &Result); 244f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot}; 245f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 246f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot} // end namespace clang 247f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot 248f3014761c955345d6e05491608e73228d014afbandroid-build-team Robot#endif 249