One more fix for Function::isSafe

This commit is contained in:
Daniel Marjamäki 2019-07-25 17:31:52 +02:00
parent 09be07f2b2
commit 4611cbb5bb
1 changed files with 10 additions and 4 deletions

View File

@ -2089,13 +2089,19 @@ const Token * Function::constructorMemberInitialization() const
bool Function::isSafe(const Settings *settings) const
{
if (settings->safeChecks.externalFunctions) {
if (nestedIn->type == Scope::ScopeType::eGlobal || nestedIn->type == Scope::ScopeType::eNamespace)
return (token->fileIndex() != 0 || !isStatic());
if (nestedIn->type == Scope::ScopeType::eGlobal || nestedIn->type == Scope::ScopeType::eNamespace) {
if (token->fileIndex() != 0 || !isStatic()) {
return true;
}
}
}
if (settings->safeChecks.internalFunctions) {
if (nestedIn->type == Scope::ScopeType::eGlobal || nestedIn->type == Scope::ScopeType::eNamespace)
return (token->fileIndex() == 0 && isStatic());
if (nestedIn->type == Scope::ScopeType::eGlobal || nestedIn->type == Scope::ScopeType::eNamespace) {
if (token->fileIndex() == 0 && isStatic()) {
return true;
}
}
}
if (settings->safeChecks.classes && access == AccessControl::Public) {