From ee4d90b4fa15e50a9994fe8f9de4945a22aff31d Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Sat, 21 Aug 2021 22:00:45 +0200 Subject: [PATCH] Refactor: fix member shadowing, return by const ref (#3407) --- lib/suppressions.cpp | 2 +- lib/suppressions.h | 2 +- lib/symboldatabase.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/suppressions.cpp b/lib/suppressions.cpp index 18165ab32..6ec2666dd 100644 --- a/lib/suppressions.cpp +++ b/lib/suppressions.cpp @@ -441,7 +441,7 @@ std::list Suppressions::getUnmatchedGlobalSuppression return result; } -std::list Suppressions::getSuppressions() const +const std::list &Suppressions::getSuppressions() const { return mSuppressions; } diff --git a/lib/suppressions.h b/lib/suppressions.h index e066b63a3..4dc08945f 100644 --- a/lib/suppressions.h +++ b/lib/suppressions.h @@ -201,7 +201,7 @@ public: * @brief Returns list of all suppressions. * @return list of suppressions */ - std::list getSuppressions() const; + const std::list &getSuppressions() const; private: /** @brief List of error which the user doesn't want to see. */ diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 4a6e14823..8a454a340 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4193,8 +4193,8 @@ void Scope::addVariable(const Token *token_, const Token *start_, const Token *e void Scope::getVariableList(const Settings* settings) { if (!bodyStartList.empty()) { - for (const Token *bodyStart: bodyStartList) - getVariableList(settings, bodyStart->next()); + for (const Token *bs: bodyStartList) + getVariableList(settings, bs->next()); } // global scope