Skip to content

Commit 35e40b4

Browse files
committed
Function: removed unnecessary SymbolDatabase parameter from addArguments()
1 parent 391411b commit 35e40b4

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/symboldatabase.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ void SymbolDatabase::createSymbolDatabaseVariableInfo()
854854

855855
for (func = scope.functionList.begin(); func != scope.functionList.end(); ++func) {
856856
// add arguments
857-
func->addArguments(this, &scope);
857+
func->addArguments(&scope);
858858
}
859859
}
860860
}
@@ -4412,17 +4412,17 @@ void SymbolDatabase::printXml(std::ostream &out) const
44124412

44134413
//---------------------------------------------------------------------------
44144414

4415-
static const Type* findVariableTypeIncludingUsedNamespaces(const SymbolDatabase& symbolDatabase, const Scope* scope, const Token* typeTok)
4415+
static const Type* findVariableTypeIncludingUsedNamespaces(const Scope* scope, const Token* typeTok)
44164416
{
4417-
const Type* argType = symbolDatabase.findVariableType(scope, typeTok);
4417+
const Type* argType = scope->symdb->findVariableType(scope, typeTok);
44184418
if (argType)
44194419
return argType;
44204420

44214421
// look for variable type in any using namespace in this scope or above
44224422
while (scope) {
44234423
for (const Scope::UsingInfo &ui : scope->usingList) {
44244424
if (ui.scope) {
4425-
argType = symbolDatabase.findVariableType(ui.scope, typeTok);
4425+
argType = scope->symdb->findVariableType(ui.scope, typeTok);
44264426
if (argType)
44274427
return argType;
44284428
}
@@ -4434,7 +4434,7 @@ static const Type* findVariableTypeIncludingUsedNamespaces(const SymbolDatabase&
44344434

44354435
//---------------------------------------------------------------------------
44364436

4437-
void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope)
4437+
void Function::addArguments(const Scope *scope)
44384438
{
44394439
// check for non-empty argument list "( ... )"
44404440
const Token * start = arg ? arg : argDef;
@@ -4495,7 +4495,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
44954495
while (Token::Match(typeTok, "const|volatile|enum|struct|::"))
44964496
typeTok = typeTok->next();
44974497
if (Token::Match(typeTok, ",|)")) { // #8333
4498-
symbolDatabase->mTokenizer.syntaxError(typeTok);
4498+
scope->symdb->mTokenizer.syntaxError(typeTok);
44994499
}
45004500
if (Token::Match(typeTok, "%type% <") && Token::Match(typeTok->linkAt(1), "> :: %type%"))
45014501
typeTok = typeTok->linkAt(1)->tokAt(2);
@@ -4514,7 +4514,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45144514
endTok = nameTok->previous();
45154515

45164516
if (hasBody())
4517-
symbolDatabase->debugMessage(nameTok, "varid0", "Function::addArguments found argument \'" + nameTok->str() + "\' with varid 0.");
4517+
scope->symdb->debugMessage(nameTok, "varid0", "Function::addArguments found argument \'" + nameTok->str() + "\' with varid 0.");
45184518
} else
45194519
endTok = typeTok;
45204520
} else
@@ -4523,7 +4523,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45234523

45244524
const ::Type *argType = nullptr;
45254525
if (!typeTok->isStandardType()) {
4526-
argType = findVariableTypeIncludingUsedNamespaces(*symbolDatabase, scope, typeTok);
4526+
argType = findVariableTypeIncludingUsedNamespaces(scope, typeTok);
45274527

45284528
// save type
45294529
const_cast<Token *>(typeTok)->type(argType);
@@ -4545,7 +4545,7 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
45454545
if (startTok == nameTok)
45464546
break;
45474547

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

45504550
if (tok->str() == ")") {
45514551
// check for a variadic function or a variadic template function
@@ -4980,7 +4980,7 @@ const Token *Scope::checkVariable(const Token *tok, AccessControl varaccess, con
49804980
const Type *vType = nullptr;
49814981

49824982
if (typetok) {
4983-
vType = findVariableTypeIncludingUsedNamespaces(*symdb, this, typetok);
4983+
vType = findVariableTypeIncludingUsedNamespaces(this, typetok);
49844984

49854985
const_cast<Token *>(typetok)->type(vType);
49864986
}

lib/symboldatabase.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ class CPPCHECKLIB Function {
774774
nonneg int initializedArgCount() const {
775775
return initArgCount;
776776
}
777-
void addArguments(const SymbolDatabase *symbolDatabase, const Scope *scope);
777+
void addArguments(const Scope *scope);
778778

779779
/** @brief check if this function is virtual in the base classes */
780780
bool isImplicitlyVirtual(bool defaultVal = false) const;

0 commit comments

Comments
 (0)