From 9b974f1b8ebea108720258a45cd7453c3350db19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Wed, 31 Mar 2021 22:07:20 +0200 Subject: [PATCH] fixed Visual Studio warnings about shadowed members (#3191) --- lib/symboldatabase.cpp | 6 +++--- lib/valueflow.cpp | 15 +++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 3604d517f..042a694e9 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4753,9 +4753,9 @@ const Scope *Scope::findRecordInBase(const std::string & name) const return base->classScope; } - const ::Type * type = base->classScope->findType(name); - if (type) - return type->classScope; + const ::Type * t = base->classScope->findType(name); + if (t) + return t->classScope; } } } diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index bf4d182a0..38d760afd 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -5873,8 +5873,7 @@ struct ContainerVariableAnalyzer : VariableAnalyzer { return Action::None; if (d == Direction::Reverse) return Action::None; - const ValueFlow::Value* value = getValue(tok); - if (!value) + if (!getValue(tok)) return Action::None; if (!tok->valueType() || !tok->valueType()->container) return Action::None; @@ -5901,10 +5900,10 @@ struct ContainerVariableAnalyzer : VariableAnalyzer { return Action::None; } - virtual void writeValue(ValueFlow::Value* value, const Token* tok, Direction d) const OVERRIDE { + virtual void writeValue(ValueFlow::Value* val, const Token* tok, Direction d) const OVERRIDE { if (d == Direction::Reverse) return; - if (!value) + if (!val) return; if (!tok->astParent()) return; @@ -5915,20 +5914,20 @@ struct ContainerVariableAnalyzer : VariableAnalyzer { if (tok->valueType()->container->stdStringLike && Token::simpleMatch(parent, "+=") && parent->astOperand2()) { const Token* rhs = parent->astOperand2(); if (rhs->tokType() == Token::eString) - value->intvalue += Token::getStrLength(rhs); + val->intvalue += Token::getStrLength(rhs); else if (rhs->valueType() && rhs->valueType()->container && rhs->valueType()->container->stdStringLike) { for (const ValueFlow::Value &rhsval : rhs->values()) { if (rhsval.isKnown() && rhsval.isContainerSizeValue()) { - value->intvalue += rhsval.intvalue; + val->intvalue += rhsval.intvalue; } } } } else if (Token::Match(tok, "%name% . %name% (")) { Library::Container::Action action = tok->valueType()->container->getAction(tok->strAt(2)); if (action == Library::Container::Action::PUSH) - value->intvalue++; + val->intvalue++; if (action == Library::Container::Action::POP) - value->intvalue--; + val->intvalue--; } }