Fix Cert C++ warnings reported by Cppcheck Premium (#5528)
This commit is contained in:
parent
06b5ef1e4d
commit
47d2c0f619
|
@ -2189,10 +2189,9 @@ Variable& Variable::operator=(const Variable &var)
|
|||
mScope = var.mScope;
|
||||
mDimensions = var.mDimensions;
|
||||
delete mValueType;
|
||||
mValueType = nullptr;
|
||||
if (var.mValueType)
|
||||
mValueType = new ValueType(*var.mValueType);
|
||||
else
|
||||
mValueType = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -2347,6 +2346,7 @@ void Variable::setValueType(const ValueType &valueType)
|
|||
return;
|
||||
}
|
||||
delete mValueType;
|
||||
mValueType = nullptr;
|
||||
mValueType = new ValueType(valueType);
|
||||
if ((mValueType->pointer > 0) && (!isArray() || Token::Match(mNameToken->previous(), "( * %name% )")))
|
||||
setFlag(fIsPointer, true);
|
||||
|
|
|
@ -546,7 +546,7 @@ public:
|
|||
* @return length of dimension
|
||||
*/
|
||||
MathLib::bigint dimension(nonneg int index_) const {
|
||||
return mDimensions[index_].num;
|
||||
return mDimensions.at(index_).num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -554,7 +554,7 @@ public:
|
|||
* @return length of dimension known
|
||||
*/
|
||||
bool dimensionKnown(nonneg int index_) const {
|
||||
return mDimensions[index_].known;
|
||||
return mDimensions.at(index_).known;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -234,14 +234,6 @@ TemplateSimplifier::TokenAndName::TokenAndName(const TokenAndName& other) :
|
|||
mToken->templateSimplifierPointer(this);
|
||||
}
|
||||
|
||||
TemplateSimplifier::TokenAndName::TokenAndName(TokenAndName&& other) NOEXCEPT :
|
||||
mToken(other.mToken), mScope(std::move(other.mScope)), mName(std::move(other.mName)), mFullName(std::move(other.mFullName)),
|
||||
mNameToken(other.mNameToken), mParamEnd(other.mParamEnd), mFlags(other.mFlags)
|
||||
{
|
||||
if (mToken)
|
||||
mToken->templateSimplifierPointer(this);
|
||||
}
|
||||
|
||||
TemplateSimplifier::TokenAndName::~TokenAndName()
|
||||
{
|
||||
if (mToken && mToken->templateSimplifierPointers())
|
||||
|
|
|
@ -152,7 +152,6 @@ public:
|
|||
*/
|
||||
TokenAndName(Token *token, std::string scope, const Token *nameToken, const Token *paramEnd);
|
||||
TokenAndName(const TokenAndName& other);
|
||||
TokenAndName(TokenAndName&& other) NOEXCEPT;
|
||||
~TokenAndName();
|
||||
|
||||
bool operator == (const TokenAndName & rhs) const {
|
||||
|
|
Loading…
Reference in New Issue