Skip to content

Commit 694a030

Browse files
committed
Function: removed unnecessary SymbolDatabase parameter from addArguments()
1 parent 7c9b773 commit 694a030

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

lib/symboldatabase.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ void SymbolDatabase::createSymbolDatabaseVariableInfo()
856856
for (Scope& scope : scopeList) {
857857
for (auto func = scope.functionList.begin(); func != scope.functionList.end(); ++func) {
858858
// add arguments
859-
func->addArguments(this, &scope);
859+
func->addArguments(&scope);
860860
}
861861
}
862862
}
@@ -4431,17 +4431,17 @@ void SymbolDatabase::printXml(std::ostream &out) const
44314431

44324432
//---------------------------------------------------------------------------
44334433

4434-
static const Type* findVariableTypeIncludingUsedNamespaces(const SymbolDatabase& symbolDatabase, const Scope* scope, const Token* typeTok)
4434+
static const Type* findVariableTypeIncludingUsedNamespaces(const Scope* scope, const Token* typeTok)
44354435
{
4436-
const Type* argType = symbolDatabase.findVariableType(scope, typeTok);
4436+
const Type* argType = scope->symdb->findVariableType(scope, typeTok);
44374437
if (argType)
44384438
return argType;
44394439

44404440
// look for variable type in any using namespace in this scope or above
44414441
while (scope) {
44424442
for (const Scope::UsingInfo &ui : scope->usingList) {
44434443
if (ui.scope) {
4444-
argType = symbolDatabase.findVariableType(ui.scope, typeTok);
4444+
argType = scope->symdb->findVariableType(ui.scope, typeTok);
44454445
if (argType)
44464446
return argType;
44474447
}
@@ -4453,7 +4453,7 @@ static const Type* findVariableTypeIncludingUsedNamespaces(const SymbolDatabase&
44534453

44544454
//---------------------------------------------------------------------------
44554455

4456-
void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope)
4456+
void Function::addArguments(const Scope *scope)
44574457
{
44584458
// check for non-empty argument list "( ... )"
44594459
const Token * start = arg ? arg : argDef;
@@ -4514,7 +4514,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45144514
while (Token::Match(typeTok, "const|volatile|enum|struct|::"))
45154515
typeTok = typeTok->next();
45164516
if (Token::Match(typeTok, ",|)")) { // #8333
4517-
symbolDatabase->mTokenizer.syntaxError(typeTok);
4517+
scope->symdb->mTokenizer.syntaxError(typeTok);
45184518
}
45194519
if (Token::Match(typeTok, "%type% <") && Token::Match(typeTok->linkAt(1), "> :: %type%"))
45204520
typeTok = typeTok->linkAt(1)->tokAt(2);
@@ -4533,7 +4533,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45334533
endTok = nameTok->previous();
45344534

45354535
if (hasBody())
4536-
symbolDatabase->debugMessage(nameTok, "varid0", "Function::addArguments found argument \'" + nameTok->str() + "\' with varid 0.");
4536+
scope->symdb->debugMessage(nameTok, "varid0", "Function::addArguments found argument \'" + nameTok->str() + "\' with varid 0.");
45374537
} else
45384538
endTok = typeTok;
45394539
} else
@@ -4542,7 +4542,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45424542

45434543
const ::Type *argType = nullptr;
45444544
if (!typeTok->isStandardType()) {
4545-
argType = findVariableTypeIncludingUsedNamespaces(*symbolDatabase, scope, typeTok);
4545+
argType = findVariableTypeIncludingUsedNamespaces(scope, typeTok);
45464546

45474547
// save type
45484548
const_cast<Token *>(typeTok)->type(argType);
@@ -4564,7 +4564,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45644564
if (startTok == nameTok)
45654565
break;
45664566

4567-
argumentList.emplace_back(nameTok, startTok, endTok, count++, AccessControl::Argument, argType, functionScope, symbolDatabase->mTokenizer.getSettings());
4567+
argumentList.emplace_back(nameTok, startTok, endTok, count++, AccessControl::Argument, argType, functionScope, scope->symdb->mTokenizer.getSettings());
45684568

45694569
if (tok->str() == ")") {
45704570
// check for a variadic function or a variadic template function
@@ -5002,7 +5002,7 @@ const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess, con
50025002
const Type *vType = nullptr;
50035003

50045004
if (typetok) {
5005-
vType = findVariableTypeIncludingUsedNamespaces(*symdb, this, typetok);
5005+
vType = findVariableTypeIncludingUsedNamespaces(this, typetok);
50065006

50075007
const_cast<Token *>(typetok)->type(vType);
50085008
}

lib/symboldatabase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ class CPPCHECKLIB Function {
776776
nonneg int initializedArgCount() const {
777777
return initArgCount;
778778
}
779-
void addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope);
779+
void addArguments(const Scope *scope);
780780

781781
/** @brief check if this function is virtual in the base classes */
782782
bool isImplicitlyVirtual(bool defaultVal = false, bool* pFoundAllBaseClasses = nullptr) const;

0 commit comments

Comments
 (0)