@@ -109,7 +109,7 @@ static int getArgumentPos(const Token* ftok, const Token* tokToFind){
109109}
110110
111111template <class T , REQUIRES(" T must be a Token class" , std::is_convertible<T*, const Token*> )>
112- static void astFlattenRecursive (T* tok, std::vector<T*>* result, const char * op, nonneg int depth = 0 )
112+ static void astFlattenRecursive (T* tok, std::vector<T*>& result, const char * op, nonneg int depth = 0 )
113113{
114114 ++depth;
115115 if (!tok || depth >= 100 )
@@ -118,21 +118,21 @@ static void astFlattenRecursive(T* tok, std::vector<T*>* result, const char* op,
118118 astFlattenRecursive (tok->astOperand1 (), result, op, depth);
119119 astFlattenRecursive (tok->astOperand2 (), result, op, depth);
120120 } else {
121- result-> push_back (tok);
121+ result. push_back (tok);
122122 }
123123}
124124
125125std::vector<const Token*> astFlatten (const Token* tok, const char * op)
126126{
127127 std::vector<const Token*> result;
128- astFlattenRecursive (tok, & result, op);
128+ astFlattenRecursive (tok, result, op);
129129 return result;
130130}
131131
132132std::vector<Token*> astFlatten (Token* tok, const char * op)
133133{
134134 std::vector<Token*> result;
135- astFlattenRecursive (tok, & result, op);
135+ astFlattenRecursive (tok, result, op);
136136 return result;
137137}
138138
@@ -865,12 +865,12 @@ const Token *findNextTokenFromBreak(const Token *breakToken)
865865}
866866
867867bool extractForLoopValues (const Token *forToken,
868- nonneg int * const varid,
869- bool * const knownInitValue,
870- MathLib::bigint * const initValue,
871- bool * const partialCond,
872- MathLib::bigint * const stepValue,
873- MathLib::bigint * const lastValue)
868+ nonneg int & varid,
869+ bool & knownInitValue,
870+ MathLib::bigint & initValue,
871+ bool & partialCond,
872+ MathLib::bigint & stepValue,
873+ MathLib::bigint & lastValue)
874874{
875875 if (!Token::simpleMatch (forToken, " for (" ) || !Token::simpleMatch (forToken->next ()->astOperand2 (), " ;" ))
876876 return false ;
@@ -880,28 +880,28 @@ bool extractForLoopValues(const Token *forToken,
880880 if (!initExpr || !initExpr->isBinaryOp () || initExpr->str () != " =" || !Token::Match (initExpr->astOperand1 (), " %var%" ))
881881 return false ;
882882 std::vector<MathLib::bigint> minInitValue = getMinValue (ValueFlow::makeIntegralInferModel (), initExpr->astOperand2 ()->values ());
883- * varid = initExpr->astOperand1 ()->varId ();
884- * knownInitValue = initExpr->astOperand2 ()->hasKnownIntValue ();
885- * initValue = minInitValue.empty () ? 0 : minInitValue.front ();
886- * partialCond = Token::Match (condExpr, " %oror%|&&" );
883+ varid = initExpr->astOperand1 ()->varId ();
884+ knownInitValue = initExpr->astOperand2 ()->hasKnownIntValue ();
885+ initValue = minInitValue.empty () ? 0 : minInitValue.front ();
886+ partialCond = Token::Match (condExpr, " %oror%|&&" );
887887 visitAstNodes (condExpr, [varid, &condExpr](const Token *tok) {
888888 if (Token::Match (tok, " %oror%|&&" ))
889889 return ChildrenToVisit::op1_and_op2;
890- if (Token::Match (tok, " <|<=" ) && tok->isBinaryOp () && tok->astOperand1 ()->varId () == * varid && tok->astOperand2 ()->hasKnownIntValue ()) {
890+ if (Token::Match (tok, " <|<=" ) && tok->isBinaryOp () && tok->astOperand1 ()->varId () == varid && tok->astOperand2 ()->hasKnownIntValue ()) {
891891 if (Token::Match (condExpr, " %oror%|&&" ) || tok->astOperand2 ()->getKnownIntValue () < condExpr->astOperand2 ()->getKnownIntValue ())
892892 condExpr = tok;
893893 }
894894 return ChildrenToVisit::none;
895895 });
896- if (!Token::Match (condExpr, " <|<=" ) || !condExpr->isBinaryOp () || condExpr->astOperand1 ()->varId () != * varid || !condExpr->astOperand2 ()->hasKnownIntValue ())
896+ if (!Token::Match (condExpr, " <|<=" ) || !condExpr->isBinaryOp () || condExpr->astOperand1 ()->varId () != varid || !condExpr->astOperand2 ()->hasKnownIntValue ())
897897 return false ;
898- if (!incExpr || !incExpr->isUnaryOp (" ++" ) || incExpr->astOperand1 ()->varId () != * varid)
898+ if (!incExpr || !incExpr->isUnaryOp (" ++" ) || incExpr->astOperand1 ()->varId () != varid)
899899 return false ;
900- * stepValue = 1 ;
900+ stepValue = 1 ;
901901 if (condExpr->str () == " <" )
902- * lastValue = condExpr->astOperand2 ()->getKnownIntValue () - 1 ;
902+ lastValue = condExpr->astOperand2 ()->getKnownIntValue () - 1 ;
903903 else
904- * lastValue = condExpr->astOperand2 ()->getKnownIntValue ();
904+ lastValue = condExpr->astOperand2 ()->getKnownIntValue ();
905905 return true ;
906906}
907907
0 commit comments