Cache and reuse value

This commit is contained in:
Dmitry-Me 2015-02-03 11:00:40 +03:00
parent 84e831c21c
commit c05e632baf
1 changed files with 3 additions and 2 deletions

View File

@ -1645,8 +1645,9 @@ static void valueFlowFunctionDefaultParameter(TokenList *tokenlist, SymbolDataba
for (std::size_t arg = function->minArgCount(); arg < function->argCount(); arg++) {
const Variable* var = function->getArgumentVar(arg);
if (var && var->hasDefault() && Token::Match(var->nameToken(), "%var% = %num%|%str% [,)]")) {
const_cast<Token*>(var->nameToken()->tokAt(2))->values.front().defaultArg = true;
valueFlowInjectParameter(tokenlist, errorLogger, settings, var, scope, var->nameToken()->tokAt(2)->values);
const Token* valueTok = var->nameToken()->tokAt(2);
const_cast<Token*>(valueTok)->values.front().defaultArg = true;
valueFlowInjectParameter(tokenlist, errorLogger, settings, var, scope, valueTok->values);
}
}
}