From 4ddf6f3b4469b2760af5188cb675c3f526aaddae Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Wed, 10 Nov 2010 16:52:52 +0100 Subject: [PATCH] Symbol database: code cleanups --- lib/checkclass.cpp | 9 +-------- lib/checkclass.h | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 8b4456063..6b9362714 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -1408,14 +1408,7 @@ void CheckClass::privateFunctions() std::list FuncList; /** @todo embedded class have access to private functions */ - int nested = 0; - std::list::const_iterator ni; - for (ni = info->nestedList.begin(); ni != info->nestedList.end(); ++ni) - { - if ((*ni)->type != SpaceInfo::Function) - nested++; - } - if (!nested) + if (!info->getNestedNonFunctions()) { for (func = info->functionList.begin(); func != info->functionList.end(); ++func) { diff --git a/lib/checkclass.h b/lib/checkclass.h index e4ae9c510..49ac6ed3e 100644 --- a/lib/checkclass.h +++ b/lib/checkclass.h @@ -312,6 +312,24 @@ private: return 0; } + /** + * @brief get the number of nested spaces that are not functions + * + * This returns the number of user defined types (class, struct, union) + * that are defined in this user defined type or namespace. + */ + unsigned int getNestedNonFunctions() const + { + unsigned int nested = 0; + std::list::const_iterator ni; + for (ni = nestedList.begin(); ni != nestedList.end(); ++ni) + { + if ((*ni)->type != SpaceInfo::Function) + nested++; + } + return nested; + } + bool isBaseClassFunc(const Token *tok); };