fixed Visual Studio warnings about shadowed members (#3191)

This commit is contained in:
Oliver Stöneberg 2021-03-31 22:07:20 +02:00 committed by GitHub
parent ede372c4f8
commit 9b974f1b8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -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;
}
}
}

View File

@ -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--;
}
}