Function::isSafe: handle global/namespace functions better

This commit is contained in:
Daniel Marjamäki 2019-07-24 08:23:05 +02:00
parent 3ec45acc43
commit 753efb4c9b
1 changed files with 10 additions and 0 deletions

View File

@ -2081,6 +2081,16 @@ const Token * Function::constructorMemberInitialization() const
bool Function::isSafe(const Settings *settings) const bool Function::isSafe(const Settings *settings) const
{ {
if (nestedIn->type == Scope::ScopeType::eGlobal) {
if (token->fileIndex() == 0 && isStatic())
return settings->safeChecks.internalFunctions;
return settings->safeChecks.externalFunctions;
}
if (nestedIn->type == Scope::ScopeType::eNamespace) {
return token->fileIndex() == 0;
}
switch (access) { switch (access) {
case AccessControl::Local: case AccessControl::Local:
case AccessControl::Private: case AccessControl::Private: