Refactorization: use Function::nestedIn instead of Function::functionScope->functionOf, which is valid even if the function implementation is not seen.
This commit is contained in:
parent
27f7917349
commit
89cf24f23f
|
@ -720,7 +720,7 @@ void CheckOther::checkRedundantAssignment()
|
||||||
else if (Token::Match(tok2, "%var% (") && nonLocal(tok->variable())) { // Called function might use the variable
|
else if (Token::Match(tok2, "%var% (") && nonLocal(tok->variable())) { // Called function might use the variable
|
||||||
const Function* func = symbolDatabase->findFunction(tok2);
|
const Function* func = symbolDatabase->findFunction(tok2);
|
||||||
const Variable* var = tok->variable();
|
const Variable* var = tok->variable();
|
||||||
if (!var || var->isGlobal() || var->isReference() || ((!func || !func->functionScope || func->functionScope->functionOf) && tok2->strAt(-1) != ".")) // Global variable, or member function
|
if (!var || var->isGlobal() || var->isReference() || ((!func || func->nestedIn) && tok2->strAt(-1) != ".")) // Global variable, or member function
|
||||||
error = false;
|
error = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1906,7 +1906,7 @@ bool Function::isImplicitlyVirtual(bool defaultVal) const
|
||||||
return true;
|
return true;
|
||||||
else if (access == Private || access == Public || access == Protected) {
|
else if (access == Private || access == Public || access == Protected) {
|
||||||
bool safe = true;
|
bool safe = true;
|
||||||
bool hasVirt = isImplicitlyVirtual_rec(functionScope->functionOf, safe);
|
bool hasVirt = isImplicitlyVirtual_rec(nestedIn, safe);
|
||||||
if (hasVirt)
|
if (hasVirt)
|
||||||
return true;
|
return true;
|
||||||
else if (safe)
|
else if (safe)
|
||||||
|
|
Loading…
Reference in New Issue