From 1250d7006585d63a1669c2f37a09e02070194aa2 Mon Sep 17 00:00:00 2001 From: firewave Date: Tue, 27 Jan 2026 12:26:19 +0100 Subject: [PATCH 1/2] made `Scope::findInNestedListRecursive()` const --- lib/symboldatabase.cpp | 4 ++-- lib/symboldatabase.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index f5ffa4e1604..11a3db1a306 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -6510,7 +6510,7 @@ Type* Scope::findType(const std::string& name) //--------------------------------------------------------------------------- -Scope *Scope::findInNestedListRecursive(const std::string & name) +const Scope *Scope::findInNestedListRecursive(const std::string & name) const { auto it = std::find_if(nestedList.cbegin(), nestedList.cend(), [&](const Scope* s) { return s->className == name; @@ -6519,7 +6519,7 @@ Scope *Scope::findInNestedListRecursive(const std::string & name) return *it; for (Scope* scope: nestedList) { - Scope *child = scope->findInNestedListRecursive(name); + const Scope *child = scope->findInNestedListRecursive(name); if (child) return child; } diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 954b31cc05b..0eaa0aab9ee 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -1157,7 +1157,7 @@ class CPPCHECKLIB Scope { * @brief find if name is in nested list * @param name name of nested scope */ - Scope *findInNestedListRecursive(const std::string & name); + const Scope *findInNestedListRecursive(const std::string & name) const; void addVariable(const Token *token_, const Token *start_, const Token *end_, AccessControl access_, const Type *type_, From 978311e3bd904a17a32b56aa1f7fa1652d724a4a Mon Sep 17 00:00:00 2001 From: firewave Date: Thu, 19 Feb 2026 16:34:41 +0100 Subject: [PATCH 2/2] symboldatabase.cpp: fixed `constVariablePointer` selfcheck warning --- lib/symboldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 11a3db1a306..332f47eb0d6 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -6518,7 +6518,7 @@ const Scope *Scope::findInNestedListRecursive(const std::string & name) const if (it != nestedList.end()) return *it; - for (Scope* scope: nestedList) { + for (const Scope* scope: nestedList) { const Scope *child = scope->findInNestedListRecursive(name); if (child) return child;