From 89cf24f23faad101abbab584bfb47d0c174d9f99 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sat, 16 Feb 2013 01:43:16 -0800 Subject: [PATCH] Refactorization: use Function::nestedIn instead of Function::functionScope->functionOf, which is valid even if the function implementation is not seen. --- lib/checkother.cpp | 2 +- lib/symboldatabase.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 5488561c6..9d742824d 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -720,7 +720,7 @@ void CheckOther::checkRedundantAssignment() else if (Token::Match(tok2, "%var% (") && nonLocal(tok->variable())) { // Called function might use the variable const Function* func = symbolDatabase->findFunction(tok2); 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; } } diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index b8b6d330b..aa010f39c 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1906,7 +1906,7 @@ bool Function::isImplicitlyVirtual(bool defaultVal) const return true; else if (access == Private || access == Public || access == Protected) { bool safe = true; - bool hasVirt = isImplicitlyVirtual_rec(functionScope->functionOf, safe); + bool hasVirt = isImplicitlyVirtual_rec(nestedIn, safe); if (hasVirt) return true; else if (safe)