Skip to content

Commit 9b87f67

Browse files
authored
ValueFlow: made some more parameters const references (#6330)
1 parent 642cdfd commit 9b87f67

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

lib/valueflow.cpp

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,7 +2181,7 @@ template<class ValueOrValues>
21812181
static Analyzer::Result valueFlowForward(Token* startToken,
21822182
const Token* exprTok,
21832183
ValueOrValues v,
2184-
TokenList& tokenlist,
2184+
const TokenList& tokenlist,
21852185
ErrorLogger& errorLogger,
21862186
const Settings& settings,
21872187
SourceLocation loc = SourceLocation::current())
@@ -3907,10 +3907,10 @@ bool ValueFlow::isLifetimeBorrowed(const Token *tok, const Settings &settings)
39073907
return true;
39083908
}
39093909

3910-
static void valueFlowLifetimeFunction(Token *tok, TokenList &tokenlist, ErrorLogger &errorLogger, const Settings &settings);
3910+
static void valueFlowLifetimeFunction(Token *tok, const TokenList &tokenlist, ErrorLogger &errorLogger, const Settings &settings);
39113911

39123912
static void valueFlowLifetimeConstructor(Token *tok,
3913-
TokenList &tokenlist,
3913+
const TokenList &tokenlist,
39143914
ErrorLogger &errorLogger,
39153915
const Settings &settings);
39163916

@@ -3989,7 +3989,7 @@ const Token* ValueFlow::getEndOfExprScope(const Token* tok, const Scope* default
39893989
return end;
39903990
}
39913991

3992-
static void valueFlowForwardLifetime(Token * tok, TokenList &tokenlist, ErrorLogger &errorLogger, const Settings &settings)
3992+
static void valueFlowForwardLifetime(Token * tok, const TokenList &tokenlist, ErrorLogger &errorLogger, const Settings &settings)
39933993
{
39943994
// Forward lifetimes to constructed variable
39953995
if (Token::Match(tok->previous(), "%var% {|(") && isVariableDecl(tok->previous())) {
@@ -4100,7 +4100,7 @@ struct LifetimeStore {
41004100
{}
41014101

41024102
template<class F>
4103-
static void forEach(TokenList& tokenlist,
4103+
static void forEach(const TokenList& tokenlist,
41044104
ErrorLogger& errorLogger,
41054105
const Settings& settings,
41064106
const std::vector<const Token*>& argtoks,
@@ -4145,7 +4145,7 @@ struct LifetimeStore {
41454145

41464146
template<class Predicate>
41474147
bool byRef(Token* tok,
4148-
TokenList& tokenlist,
4148+
const TokenList& tokenlist,
41494149
ErrorLogger& errorLogger,
41504150
const Settings& settings,
41514151
Predicate pred,
@@ -4186,7 +4186,7 @@ struct LifetimeStore {
41864186
}
41874187

41884188
bool byRef(Token* tok,
4189-
TokenList& tokenlist,
4189+
const TokenList& tokenlist,
41904190
ErrorLogger& errorLogger,
41914191
const Settings& settings,
41924192
SourceLocation loc = SourceLocation::current())
@@ -4204,7 +4204,7 @@ struct LifetimeStore {
42044204

42054205
template<class Predicate>
42064206
bool byVal(Token* tok,
4207-
TokenList& tokenlist,
4207+
const TokenList& tokenlist,
42084208
ErrorLogger& errorLogger,
42094209
const Settings& settings,
42104210
Predicate pred,
@@ -4281,7 +4281,7 @@ struct LifetimeStore {
42814281
}
42824282

42834283
bool byVal(Token* tok,
4284-
TokenList& tokenlist,
4284+
const TokenList& tokenlist,
42854285
ErrorLogger& errorLogger,
42864286
const Settings& settings,
42874287
SourceLocation loc = SourceLocation::current())
@@ -4299,7 +4299,7 @@ struct LifetimeStore {
42994299

43004300
template<class Predicate>
43014301
bool byDerefCopy(Token* tok,
4302-
TokenList& tokenlist,
4302+
const TokenList& tokenlist,
43034303
ErrorLogger& errorLogger,
43044304
const Settings& settings,
43054305
Predicate pred,
@@ -4335,7 +4335,7 @@ struct LifetimeStore {
43354335
}
43364336

43374337
bool byDerefCopy(Token* tok,
4338-
TokenList& tokenlist,
4338+
const TokenList& tokenlist,
43394339
ErrorLogger& errorLogger,
43404340
const Settings& settings,
43414341
SourceLocation loc = SourceLocation::current()) const
@@ -4354,7 +4354,7 @@ struct LifetimeStore {
43544354
private:
43554355
// cppcheck-suppress naming-privateMemberVariable
43564356
Token* forwardTok{};
4357-
void forwardLifetime(Token* tok, TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings) {
4357+
void forwardLifetime(Token* tok, const TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings) {
43584358
forwardTok = tok;
43594359
valueFlowForwardLifetime(tok, tokenlist, errorLogger, settings);
43604360
}
@@ -4393,7 +4393,7 @@ static void valueFlowLifetimeUserConstructor(Token* tok,
43934393
const Function* constructor,
43944394
const std::string& name,
43954395
const std::vector<const Token*>& args,
4396-
TokenList& tokenlist,
4396+
const TokenList& tokenlist,
43974397
ErrorLogger& errorLogger,
43984398
const Settings& settings)
43994399
{
@@ -4483,7 +4483,7 @@ static void valueFlowLifetimeUserConstructor(Token* tok,
44834483
}
44844484
}
44854485

4486-
static void valueFlowLifetimeFunction(Token *tok, TokenList &tokenlist, ErrorLogger &errorLogger, const Settings &settings)
4486+
static void valueFlowLifetimeFunction(Token *tok, const TokenList &tokenlist, ErrorLogger &errorLogger, const Settings &settings)
44874487
{
44884488
if (!Token::Match(tok, "%name% ("))
44894489
return;
@@ -4674,7 +4674,7 @@ static const Function* findConstructor(const Scope* scope, const Token* tok, con
46744674

46754675
static void valueFlowLifetimeClassConstructor(Token* tok,
46764676
const Type* t,
4677-
TokenList& tokenlist,
4677+
const TokenList& tokenlist,
46784678
ErrorLogger& errorLogger,
46794679
const Settings& settings)
46804680
{
@@ -4739,7 +4739,7 @@ static void valueFlowLifetimeClassConstructor(Token* tok,
47394739
}
47404740
}
47414741

4742-
static void valueFlowLifetimeConstructor(Token* tok, TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings)
4742+
static void valueFlowLifetimeConstructor(Token* tok, const TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings)
47434743
{
47444744
if (!Token::Match(tok, "(|{"))
47454745
return;
@@ -5227,7 +5227,7 @@ static Token* findEndOfFunctionCallForParameter(Token* parameterToken)
52275227
return nextAfterAstRightmostLeaf(parent);
52285228
}
52295229

5230-
static void valueFlowAfterMove(TokenList& tokenlist, const SymbolDatabase& symboldatabase, ErrorLogger& errorLogger, const Settings& settings)
5230+
static void valueFlowAfterMove(const TokenList& tokenlist, const SymbolDatabase& symboldatabase, ErrorLogger& errorLogger, const Settings& settings)
52315231
{
52325232
if (!tokenlist.isCPP() || settings.standards.cpp < Standards::CPP11)
52335233
return;
@@ -5873,7 +5873,7 @@ static void valueFlowForwardAssign(Token* const tok,
58735873
std::vector<const Variable*> vars,
58745874
std::list<ValueFlow::Value> values,
58755875
const bool init,
5876-
TokenList& tokenlist,
5876+
const TokenList& tokenlist,
58775877
ErrorLogger& errorLogger,
58785878
const Settings& settings)
58795879
{
@@ -5983,7 +5983,7 @@ static void valueFlowForwardAssign(Token* const tok,
59835983
const std::list<ValueFlow::Value>& values,
59845984
const bool /*unused*/,
59855985
const bool init,
5986-
TokenList& tokenlist,
5986+
const TokenList& tokenlist,
59875987
ErrorLogger& errorLogger,
59885988
const Settings& settings)
59895989
{
@@ -6201,7 +6201,7 @@ static std::vector<const Variable*> getVariables(const Token* tok)
62016201
return result;
62026202
}
62036203

6204-
static void valueFlowAfterSwap(TokenList& tokenlist,
6204+
static void valueFlowAfterSwap(const TokenList& tokenlist,
62056205
const SymbolDatabase& symboldatabase,
62066206
ErrorLogger& errorLogger,
62076207
const Settings& settings)
@@ -8806,7 +8806,7 @@ static std::vector<ValueFlow::Value> getContainerSizeFromConstructor(const Token
88068806
return getContainerSizeFromConstructorArgs(args, valueType->container, known);
88078807
}
88088808

8809-
static void valueFlowContainerSetTokValue(TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings, const Token* tok, Token* initList)
8809+
static void valueFlowContainerSetTokValue(const TokenList& tokenlist, ErrorLogger& errorLogger, const Settings& settings, const Token* tok, Token* initList)
88108810
{
88118811
ValueFlow::Value value;
88128812
value.valueType = ValueFlow::Value::ValueType::TOK;
@@ -8844,7 +8844,7 @@ static MathLib::bigint valueFlowGetStrLength(const Token* tok)
88448844
return 0;
88458845
}
88468846

8847-
static void valueFlowContainerSize(TokenList& tokenlist,
8847+
static void valueFlowContainerSize(const TokenList& tokenlist,
88488848
const SymbolDatabase& symboldatabase,
88498849
ErrorLogger& errorLogger,
88508850
const Settings& settings,
@@ -9242,7 +9242,7 @@ static bool getMinMaxValues(const std::string &typestr, const Settings &settings
92429242
return getMinMaxValues(&vt, settings.platform, minvalue, maxvalue);
92439243
}
92449244

9245-
static void valueFlowSafeFunctions(TokenList& tokenlist, const SymbolDatabase& symboldatabase, ErrorLogger& errorLogger, const Settings& settings)
9245+
static void valueFlowSafeFunctions(const TokenList& tokenlist, const SymbolDatabase& symboldatabase, ErrorLogger& errorLogger, const Settings& settings)
92469246
{
92479247
for (const Scope *functionScope : symboldatabase.functionScopes) {
92489248
if (!functionScope->bodyStart)

0 commit comments

Comments
 (0)