[NFC] Remove superfluous parameter

- MacroArgs already knows the maximum number of arguments that can be supplied to the macro.  No need to pass MacroInfo (information about the macro definition) to the call to getPreExpArgument (which by the way might benefit from being called getExpandedArgument() ?) for it to compute the number of arguments.

llvm-svn: 314593
This commit is contained in:
Faisal Vali 2017-09-30 13:58:38 +00:00
parent 70947e2224
commit 333133e2c8
3 changed files with 7 additions and 8 deletions

View File

@ -93,7 +93,7 @@ public:
/// getPreExpArgument - Return the pre-expanded form of the specified
/// argument.
const std::vector<Token> &
getPreExpArgument(unsigned Arg, const MacroInfo *MI, Preprocessor &PP);
getPreExpArgument(unsigned Arg, Preprocessor &PP);
/// getStringifiedArgument - Compute, cache, and return the specified argument
/// that has been 'stringified' as required by the # operator.

View File

@ -150,14 +150,13 @@ bool MacroArgs::ArgNeedsPreexpansion(const Token *ArgTok,
/// getPreExpArgument - Return the pre-expanded form of the specified
/// argument.
const std::vector<Token> &
MacroArgs::getPreExpArgument(unsigned Arg, const MacroInfo *MI,
Preprocessor &PP) {
assert(Arg < MI->getNumParams() && "Invalid argument number!");
const std::vector<Token> &MacroArgs::getPreExpArgument(unsigned Arg,
Preprocessor &PP) {
assert(Arg < getNumMacroArguments() && "Invalid argument number!");
// If we have already computed this, return it.
if (PreExpArgTokens.size() < MI->getNumParams())
PreExpArgTokens.resize(MI->getNumParams());
if (PreExpArgTokens.size() < getNumMacroArguments())
PreExpArgTokens.resize(getNumMacroArguments());
std::vector<Token> &Result = PreExpArgTokens[Arg];
if (!Result.empty()) return Result;

View File

@ -275,7 +275,7 @@ void TokenLexer::ExpandFunctionArguments() {
// avoids some work in common cases.
const Token *ArgTok = ActualArgs->getUnexpArgument(ArgNo);
if (ActualArgs->ArgNeedsPreexpansion(ArgTok, PP))
ResultArgToks = &ActualArgs->getPreExpArgument(ArgNo, Macro, PP)[0];
ResultArgToks = &ActualArgs->getPreExpArgument(ArgNo, PP)[0];
else
ResultArgToks = ArgTok; // Use non-preexpanded tokens.