@@ -2388,28 +2388,28 @@ Token* getTokenArgumentFunction(Token* tok, int& argn) {
23882388
23892389std::vector<const Variable*> getArgumentVars (const Token* tok, int argnr)
23902390{
2391- std::vector<const Variable*> result;
23922391 if (!tok)
2393- return result ;
2392+ return {} ;
23942393 if (tok->function ()) {
23952394 const Variable* argvar = tok->function ()->getArgumentVar (argnr);
23962395 if (argvar)
23972396 return {argvar};
2398- return result ;
2397+ return {} ;
23992398 }
24002399 if (tok->variable () || Token::simpleMatch (tok, " {" ) || Token::Match (tok->previous (), " %type% (|{" )) {
24012400 const Type* type = Token::typeOf (tok);
24022401 if (!type)
2403- return result ;
2402+ return {} ;
24042403 const Scope* typeScope = type->classScope ;
24052404 if (!typeScope)
2406- return result ;
2405+ return {} ;
24072406 const bool tokIsBrace = Token::simpleMatch (tok, " {" );
24082407 // Aggregate constructor
24092408 if (tokIsBrace && typeScope->numConstructors == 0 && argnr < typeScope->varlist .size ()) {
24102409 auto it = std::next (typeScope->varlist .cbegin (), argnr);
24112410 return {&*it};
24122411 }
2412+ std::vector<const Variable*> result;
24132413 const int argCount = numberOfArguments (tok);
24142414 const bool constructor = tokIsBrace || (tok->variable () && tok->variable ()->nameToken () == tok);
24152415 for (const Function &function : typeScope->functionList ) {
@@ -2423,8 +2423,9 @@ std::vector<const Variable*> getArgumentVars(const Token* tok, int argnr)
24232423 if (argvar)
24242424 result.push_back (argvar);
24252425 }
2426+ return result;
24262427 }
2427- return result ;
2428+ return {} ;
24282429}
24292430
24302431static bool isCPPCastKeyword (const Token* tok)
@@ -3528,13 +3529,13 @@ static void getLHSVariablesRecursive(std::vector<const Variable*>& vars, const T
35283529
35293530std::vector<const Variable*> getLHSVariables (const Token* tok)
35303531{
3531- std::vector<const Variable*> result;
35323532 if (!Token::Match (tok, " %assign%|(|{" ))
3533- return result ;
3533+ return {} ;
35343534 if (!tok->astOperand1 ())
3535- return result ;
3535+ return {} ;
35363536 if (tok->astOperand1 ()->varId () > 0 && tok->astOperand1 ()->variable ())
35373537 return {tok->astOperand1 ()->variable ()};
3538+ std::vector<const Variable*> result;
35383539 getLHSVariablesRecursive (result, tok->astOperand1 ());
35393540 return result;
35403541}
0 commit comments