Skip to content

Commit 5d379b1

Browse files
committed
checkstl.cpp: pass Settings by reference
1 parent 2538dcd commit 5d379b1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

lib/checkstl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,10 +2869,10 @@ namespace {
28692869
struct LoopAnalyzer {
28702870
const Token* bodyTok = nullptr;
28712871
const Token* loopVar = nullptr;
2872-
const Settings* settings = nullptr;
2872+
const Settings& settings;
28732873
std::set<nonneg int> varsChanged;
28742874

2875-
explicit LoopAnalyzer(const Token* tok, const Settings* psettings)
2875+
explicit LoopAnalyzer(const Token* tok, const Settings& psettings)
28762876
: bodyTok(tok->linkAt(1)->next()), settings(psettings)
28772877
{
28782878
const Token* splitTok = tok->next()->astOperand2();
@@ -2894,11 +2894,11 @@ namespace {
28942894
int n = 1 + (astIsPointer(tok) ? 1 : 0);
28952895
for (int i = 0; i < n; i++) {
28962896
bool inconclusive = false;
2897-
if (isVariableChangedByFunctionCall(tok, i, *settings, &inconclusive))
2897+
if (isVariableChangedByFunctionCall(tok, i, settings, &inconclusive))
28982898
return true;
28992899
if (inconclusive)
29002900
return true;
2901-
if (isVariableChanged(tok, i, *settings))
2901+
if (isVariableChanged(tok, i, settings))
29022902
return true;
29032903
}
29042904
return false;
@@ -3044,7 +3044,7 @@ void CheckStlImpl::useStlAlgorithm()
30443044
continue;
30453045
if (!Token::simpleMatch(tok->linkAt(1), ") {"))
30463046
continue;
3047-
LoopAnalyzer a{tok, &mSettings};
3047+
LoopAnalyzer a{tok, mSettings};
30483048
std::string algoName = a.findAlgo();
30493049
if (!algoName.empty()) {
30503050
useStlAlgorithmError(tok, algoName);

0 commit comments

Comments
 (0)