A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://clang.llvm.org/doxygen/MacroArgs_8cpp_source.html below:

clang: lib/Lex/MacroArgs.cpp Source File

17#include "llvm/Support/SaveAndRestore.h" 20using namespace clang

;

27 "Can't have args for an object-like macro!"

);

29 unsigned

ClosestMatch = ~0

U

;

33 for

(

MacroArgs

**Entry = &PP.MacroArgCache; *Entry;

34

Entry = &(*Entry)->ArgCache) {

35 if

((*Entry)->NumUnexpArgTokens >= UnexpArgTokens.size() &&

36

(*Entry)->NumUnexpArgTokens < ClosestMatch) {

40 if

((*Entry)->NumUnexpArgTokens == UnexpArgTokens.size())

43

ClosestMatch = (*Entry)->NumUnexpArgTokens;

51

llvm::safe_malloc(totalSizeToAlloc<Token>(UnexpArgTokens.size())))

56

*ResultEnt =

Result

->ArgCache;

57 Result

->NumUnexpArgTokens = UnexpArgTokens.size();

58 Result

->VarargsElided = VarargsElided;

63 if

(!UnexpArgTokens.empty()) {

64 static_assert

(std::is_trivial_v<Token>,

65 "assume trivial copyability if copying into the " 66 "uninitialized array (as opposed to reusing a cached " 68

std::copy(UnexpArgTokens.begin(), UnexpArgTokens.end(),

80 for

(

unsigned

i = 0, e = PreExpArgTokens.size(); i != e; ++i)

81

PreExpArgTokens[i].clear();

84

ArgCache = PP.MacroArgCache;

85

PP.MacroArgCache =

this

;

96 static_assert

(std::is_trivially_destructible_v<Token>,

97 "assume trivially destructible and forego destructors"

);

108 unsigned

NumArgTokens = 0;

109 for

(; ArgPtr->

isNot

(tok::eof); ++ArgPtr)

122 const Token

*Start = getTrailingObjects<Token>();

127

assert(

Result

< Start+NumUnexpArgTokens &&

"Invalid arg #"

);

128 if

(

Result

->is(tok::eof))

131

assert(

Result

< Start+NumUnexpArgTokens &&

"Invalid arg #"

);

149 for

(; ArgTok->

isNot

(tok::eof); ++ArgTok)

151 if

(II->hasMacroDefinition())

168

std::vector<Token> &

Result

= PreExpArgTokens[Arg];

171 SaveAndRestore

PreExpandingMacroArgs(PP.InMacroArgPreExpansion,

true

);

180

PP.EnterTokenStream(AT, NumToks,

false

,

188

}

while

(

Result

.back().isNot(tok::eof));

195 if

(PP.InCachingLexMode())

196

PP.ExitCachingLexMode();

213

Tok.

setKind

(Charify ? tok::char_constant : tok::string_literal);

215 const Token

*ArgTokStart = ArgToks;

221 bool

isFirst =

true

;

222 for

(; ArgToks->

isNot

(tok::eof); ++ArgToks) {

223 const Token

&Tok = *ArgToks;

231

Tok.

is

(tok::char_constant) ||

232

Tok.

is

(tok::wide_char_constant) ||

233

Tok.

is

(tok::utf8_char_constant) ||

234

Tok.

is

(tok::utf16_char_constant) ||

235

Tok.

is

(tok::utf32_char_constant)) {

240 Result

.append(Str.begin(), Str.end());

242

}

else if

(Tok.

is

(tok::code_completion)) {

247 unsigned

CurStrLen =

Result

.size();

249 const char

*BufPtr =

Result

.data() + CurStrLen;

256 if

(ActualTokLen && BufPtr != &

Result

[CurStrLen])

261 Result

.resize(CurStrLen+ActualTokLen);

268 if

(

Result

.back() ==

'\\'

) {

271 unsigned

FirstNonSlash =

Result

.size()-2;

273 while

(

Result

[FirstNonSlash] ==

'\\'

)

275 if

((

Result

.size()-1-FirstNonSlash) & 1) {

277

PP.

Diag

(ArgToks[-1], diag::pp_invalid_string_literal);

293

isBad =

Result

[1] ==

'\''

;

298

PP.

Diag

(ArgTokStart[0], diag::err_invalid_character_to_charify);

304

ExpansionLocStart, ExpansionLocEnd);

Defines the clang::MacroInfo and clang::MacroDirective classes.

Defines the clang::Preprocessor interface.

__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)

One of these records is kept for each identifier that is lexed.

static std::string Stringify(StringRef Str, bool Charify=false)

Stringify - Convert the specified string into a C string by i) escaping '\' and " characters and ii) ...

MacroArgs - An instance of this class captures information about the formal arguments specified to a ...

const Token * getUnexpArgument(unsigned Arg) const

getUnexpArgument - Return a pointer to the first token of the unexpanded token list for the specified...

MacroArgs * deallocate()

deallocate - This should only be called by the Preprocessor when managing its freelist.

const std::vector< Token > & getPreExpArgument(unsigned Arg, Preprocessor &PP)

getPreExpArgument - Return the pre-expanded form of the specified argument.

static MacroArgs * create(const MacroInfo *MI, ArrayRef< Token > UnexpArgTokens, bool VarargsElided, Preprocessor &PP)

MacroArgs ctor function - Create a new MacroArgs object with the specified macro and argument info.

static unsigned getArgLength(const Token *ArgPtr)

getArgLength - Given a pointer to an expanded or unexpanded argument, return the number of tokens,...

bool ArgNeedsPreexpansion(const Token *ArgTok, Preprocessor &PP) const

ArgNeedsPreexpansion - If we can prove that the argument won't be affected by pre-expansion,...

bool invokedWithVariadicArgument(const MacroInfo *const MI, Preprocessor &PP)

Returns true if the macro was defined with a variadic (ellipsis) parameter AND was invoked with at le...

unsigned getNumMacroArguments() const

getNumMacroArguments - Return the number of arguments the invoked macro expects.

static Token StringifyArgument(const Token *ArgToks, Preprocessor &PP, bool Charify, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd)

StringifyArgument - Implement C99 6.10.3.2p2, converting a sequence of tokens into the literal string...

void destroy(Preprocessor &PP)

destroy - Destroy and deallocate the memory for this object.

Encapsulates the data about a macro definition (e.g.

bool isFunctionLike() const

unsigned getNumParams() const

Engages in a tight little dance with the lexer to efficiently preprocess tokens.

void CreateString(StringRef Str, Token &Tok, SourceLocation ExpansionLocStart=SourceLocation(), SourceLocation ExpansionLocEnd=SourceLocation())

Plop the specified string into a scratch buffer and set the specified token's location and length to ...

void Lex(Token &Result)

Lex the next token for this preprocessor.

StringRef getSpelling(SourceLocation loc, SmallVectorImpl< char > &buffer, bool *invalid=nullptr) const

Return the 'spelling' of the token at the given location; does not go up to the spelling location or ...

void RemoveTopOfLexerStack()

Pop the current lexer/macro exp off the top of the lexer stack.

void CodeCompleteNaturalLanguage()

Hook used by the lexer to invoke the "natural language" code completion point.

DiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID) const

Forwarding function for diagnostics.

Encodes a location in the source.

Token - This structure provides full information about a lexed token.

IdentifierInfo * getIdentifierInfo() const

unsigned getLength() const

void setKind(tok::TokenKind K)

bool is(tok::TokenKind K) const

is/isNot - Predicates to check if this token is a specific kind, as in "if (Tok.is(tok::l_brace)) {....

tok::TokenKind getKind() const

bool isAtStartOfLine() const

isAtStartOfLine - Return true if this token is at the start of a line.

bool hasLeadingSpace() const

Return true if this token has whitespace before it.

bool isNot(tok::TokenKind K) const

void startToken()

Reset all flags to cleared.

bool isStringLiteral(TokenKind K)

Return true if this is a C or C++ string-literal (or C++11 user-defined-string-literal) token.

The JSON file list parser is used to communicate input to InstallAPI.

@ Result

The result type of a method or function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4