Skip to content

Commit 7b88d1b

Browse files
committed
Scope: removed unnecessary Settings parameter from checkVariable()
1 parent b5f70c0 commit 7b88d1b

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

lib/symboldatabase.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,9 @@ void SymbolDatabase::createSymbolDatabaseFindAllScopes()
735735
scope->nestedList.push_back(&scopeList.back());
736736
scope = &scopeList.back();
737737
if (scope->type == ScopeType::eFor)
738-
scope->checkVariable(tok->tokAt(2), AccessControl::Local, mTokenizer.getSettings()); // check for variable declaration and add it to new scope if found
738+
scope->checkVariable(tok->tokAt(2), AccessControl::Local); // check for variable declaration and add it to new scope if found
739739
else if (scope->type == ScopeType::eCatch)
740-
scope->checkVariable(tok->tokAt(2), AccessControl::Throw, mTokenizer.getSettings()); // check for variable declaration and add it to new scope if found
740+
scope->checkVariable(tok->tokAt(2), AccessControl::Throw); // check for variable declaration and add it to new scope if found
741741
tok = tok->next();
742742
inIfCondition.push(scopeStartTok);
743743
} else if (Token::Match(tok, "%var% {")) {
@@ -4835,7 +4835,7 @@ void Scope::getVariableList(const Token* start, const Token* end)
48354835
{
48364836
// Variable declared in condition: if (auto x = bar())
48374837
if (Token::Match(classDef, "if|while ( %type%") && Token::simpleMatch(classDef->next()->astOperand2(), "=")) {
4838-
checkVariable(classDef->tokAt(2), defaultAccess(), symdb->mTokenizer.getSettings());
4838+
checkVariable(classDef->tokAt(2), defaultAccess());
48394839
}
48404840

48414841
AccessControl varaccess = defaultAccess();
@@ -4932,14 +4932,14 @@ void Scope::getVariableList(const Token* start, const Token* end)
49324932
if (tok->str() == ";")
49334933
continue;
49344934

4935-
tok = checkVariable(tok, varaccess, symdb->mTokenizer.getSettings());
4935+
tok = checkVariable(tok, varaccess);
49364936

49374937
if (!tok)
49384938
break;
49394939
}
49404940
}
49414941

4942-
const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess, const Settings& settings)
4942+
const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess)
49434943
{
49444944
// Is it a throw..?
49454945
if (tok->isKeyword() && Token::Match(tok, "throw %any% (") &&
@@ -4969,7 +4969,7 @@ const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess, con
49694969
const Token *typestart = tok;
49704970

49714971
// C++17 structured bindings
4972-
if (tok && tok->isCpp() && (settings.standards.cpp >= Standards::CPP17) && Token::Match(tok, "auto &|&&| [")) {
4972+
if (tok && tok->isCpp() && (symdb->mTokenizer.getSettings().standards.cpp >= Standards::CPP17) && Token::Match(tok, "auto &|&&| [")) {
49734973
const Token *typeend = Token::findsimplematch(typestart, "[")->previous();
49744974
for (tok = typeend->tokAt(2); Token::Match(tok, "%name%|,"); tok = tok->next()) {
49754975
if (tok->varId())

lib/symboldatabase.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,10 +1178,9 @@ class CPPCHECKLIB Scope {
11781178
* @brief check if statement is variable declaration and add it if it is
11791179
* @param tok pointer to start of statement
11801180
* @param varaccess access control of statement
1181-
* @param settings Settings
11821181
* @return pointer to last token
11831182
*/
1184-
const Token *checkVariable(const Token *tok, AccessControl varaccess, const Settings& settings);
1183+
const Token *checkVariable(const Token *tok, AccessControl varaccess);
11851184

11861185
/**
11871186
* @brief get variable from name

0 commit comments

Comments
 (0)