From 237314fb5110e4dc20c274417dec5d5f3423d324 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 16 Jun 2018 21:45:53 +0200 Subject: [PATCH] Rename _values to mValues --- lib/token.cpp | 62 +++++++++++++++++++++++++-------------------------- lib/token.h | 24 ++++++++++---------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/lib/token.cpp b/lib/token.cpp index 76d957dca..ea9e94185 100644 --- a/lib/token.cpp +++ b/lib/token.cpp @@ -55,7 +55,7 @@ Token::Token(TokensFrontBack *tokensFrontBack) : mAstParent(nullptr), mOriginalName(nullptr), mValueType(nullptr), - _values(nullptr) + mValues(nullptr) { } @@ -63,7 +63,7 @@ Token::~Token() { delete mOriginalName; delete mValueType; - delete _values; + delete mValues; } static const std::set controlFlowKeywords = { @@ -260,7 +260,7 @@ void Token::swapWithNext() std::swap(mScope, mNext->mScope); std::swap(mFunction, mNext->mFunction); std::swap(mOriginalName, mNext->mOriginalName); - std::swap(_values, mNext->_values); + std::swap(mValues, mNext->mValues); std::swap(mValueType, mNext->mValueType); std::swap(mProgressValue, mNext->mProgressValue); } @@ -282,9 +282,9 @@ void Token::takeData(Token *fromToken) mOriginalName = fromToken->mOriginalName; fromToken->mOriginalName = nullptr; } - delete _values; - _values = fromToken->_values; - fromToken->_values = nullptr; + delete mValues; + mValues = fromToken->mValues; + fromToken->mValues = nullptr; delete mValueType; mValueType = fromToken->mValueType; fromToken->mValueType = nullptr; @@ -1362,19 +1362,19 @@ void Token::printValueFlow(bool xml, std::ostream &out) const else out << "\n\n##Value flow" << std::endl; for (const Token *tok = this; tok; tok = tok->next()) { - if (!tok->_values) + if (!tok->mValues) continue; if (xml) - out << " _values << "\">" << std::endl; + out << " mValues << "\">" << std::endl; else if (line != tok->linenr()) out << "Line " << tok->linenr() << std::endl; line = tok->linenr(); if (!xml) { - out << " " << tok->str() << (tok->_values->front().isKnown() ? " always " : " possible "); - if (tok->_values->size() > 1U) + out << " " << tok->str() << (tok->mValues->front().isKnown() ? " always " : " possible "); + if (tok->mValues->size() > 1U) out << '{'; } - for (std::list::const_iterator it=tok->_values->begin(); it!=tok->_values->end(); ++it) { + for (std::list::const_iterator it=tok->mValues->begin(); it!=tok->mValues->end(); ++it) { if (xml) { out << " valueType) { @@ -1409,7 +1409,7 @@ void Token::printValueFlow(bool xml, std::ostream &out) const } else { - if (it != tok->_values->begin()) + if (it != tok->mValues->begin()) out << ","; switch (it->valueType) { case ValueFlow::Value::INT: @@ -1435,7 +1435,7 @@ void Token::printValueFlow(bool xml, std::ostream &out) const } if (xml) out << " " << std::endl; - else if (tok->_values->size() > 1U) + else if (tok->mValues->size() > 1U) out << '}' << std::endl; else out << std::endl; @@ -1446,11 +1446,11 @@ void Token::printValueFlow(bool xml, std::ostream &out) const const ValueFlow::Value * Token::getValueLE(const MathLib::bigint val, const Settings *settings) const { - if (!_values) + if (!mValues) return nullptr; const ValueFlow::Value *ret = nullptr; std::list::const_iterator it; - for (it = _values->begin(); it != _values->end(); ++it) { + for (it = mValues->begin(); it != mValues->end(); ++it) { if (it->isIntValue() && it->intvalue <= val) { if (!ret || ret->isInconclusive() || (ret->condition && !it->isInconclusive())) ret = &(*it); @@ -1469,11 +1469,11 @@ const ValueFlow::Value * Token::getValueLE(const MathLib::bigint val, const Sett const ValueFlow::Value * Token::getValueGE(const MathLib::bigint val, const Settings *settings) const { - if (!_values) + if (!mValues) return nullptr; const ValueFlow::Value *ret = nullptr; std::list::const_iterator it; - for (it = _values->begin(); it != _values->end(); ++it) { + for (it = mValues->begin(); it != mValues->end(); ++it) { if (it->isIntValue() && it->intvalue >= val) { if (!ret || ret->isInconclusive() || (ret->condition && !it->isInconclusive())) ret = &(*it); @@ -1492,11 +1492,11 @@ const ValueFlow::Value * Token::getValueGE(const MathLib::bigint val, const Sett const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, unsigned int argnr, const Settings *settings) const { - if (!_values || !settings) + if (!mValues || !settings) return nullptr; const ValueFlow::Value *ret = nullptr; std::list::const_iterator it; - for (it = _values->begin(); it != _values->end(); ++it) { + for (it = mValues->begin(); it != mValues->end(); ++it) { if (it->isIntValue() && !settings->library.isargvalid(ftok, argnr, it->intvalue)) { if (!ret || ret->isInconclusive() || (ret->condition && !it->isInconclusive())) ret = &(*it); @@ -1515,12 +1515,12 @@ const ValueFlow::Value * Token::getInvalidValue(const Token *ftok, unsigned int const Token *Token::getValueTokenMinStrSize() const { - if (!_values) + if (!mValues) return nullptr; const Token *ret = nullptr; std::size_t minsize = ~0U; std::list::const_iterator it; - for (it = _values->begin(); it != _values->end(); ++it) { + for (it = mValues->begin(); it != mValues->end(); ++it) { if (it->isTokValue() && it->tokvalue && it->tokvalue->tokType() == Token::eString) { const std::size_t size = getStrSize(it->tokvalue); if (!ret || size < minsize) { @@ -1534,12 +1534,12 @@ const Token *Token::getValueTokenMinStrSize() const const Token *Token::getValueTokenMaxStrLength() const { - if (!_values) + if (!mValues) return nullptr; const Token *ret = nullptr; std::size_t maxlength = 0U; std::list::const_iterator it; - for (it = _values->begin(); it != _values->end(); ++it) { + for (it = mValues->begin(); it != mValues->end(); ++it) { if (it->isTokValue() && it->tokvalue && it->tokvalue->tokType() == Token::eString) { const std::size_t length = getStrLength(it->tokvalue); if (!ret || length > maxlength) { @@ -1593,20 +1593,20 @@ const Token *Token::getValueTokenDeadPointer() const bool Token::addValue(const ValueFlow::Value &value) { - if (value.isKnown() && _values) { + if (value.isKnown() && mValues) { // Clear all other values since value is known - _values->clear(); + mValues->clear(); } - if (_values) { + if (mValues) { // Don't handle more than 10 values for performance reasons // TODO: add setting? - if (_values->size() >= 10U) + if (mValues->size() >= 10U) return false; // if value already exists, don't add it again std::list::iterator it; - for (it = _values->begin(); it != _values->end(); ++it) { + for (it = mValues->begin(); it != mValues->end(); ++it) { // different intvalue => continue if (it->intvalue != value.intvalue) continue; @@ -1630,17 +1630,17 @@ bool Token::addValue(const ValueFlow::Value &value) } // Add value - if (it == _values->end()) { + if (it == mValues->end()) { ValueFlow::Value v(value); if (v.varId == 0) v.varId = mVarId; - _values->push_back(v); + mValues->push_back(v); } } else { ValueFlow::Value v(value); if (v.varId == 0) v.varId = mVarId; - _values = new std::list(1, v); + mValues = new std::list(1, v); } return true; diff --git a/lib/token.h b/lib/token.h index 0e608b1ad..e6804d272 100644 --- a/lib/token.h +++ b/lib/token.h @@ -808,7 +808,7 @@ public: } const std::list& values() const { - return _values ? *_values : emptyValueList; + return mValues ? *mValues : emptyValueList; } /** @@ -823,17 +823,17 @@ public: } bool hasKnownIntValue() const { - return _values && _values->size() == 1U && _values->front().isKnown() && _values->front().isIntValue(); + return mValues && mValues->size() == 1U && mValues->front().isKnown() && mValues->front().isIntValue(); } bool hasKnownValue() const { - return _values && _values->size() == 1U && _values->front().isKnown(); + return mValues && mValues->size() == 1U && mValues->front().isKnown(); } const ValueFlow::Value * getValue(const MathLib::bigint val) const { - if (!_values) + if (!mValues) return nullptr; - for (std::list::const_iterator it = _values->begin(); it != _values->end(); ++it) { + for (std::list::const_iterator it = mValues->begin(); it != mValues->end(); ++it) { if (it->isIntValue() && it->intvalue == val) return &(*it); } @@ -841,10 +841,10 @@ public: } const ValueFlow::Value * getMaxValue(bool condition) const { - if (!_values) + if (!mValues) return nullptr; const ValueFlow::Value *ret = nullptr; - for (std::list::const_iterator it = _values->begin(); it != _values->end(); ++it) { + for (std::list::const_iterator it = mValues->begin(); it != mValues->end(); ++it) { if (!it->isIntValue()) continue; if ((!ret || it->intvalue > ret->intvalue) && @@ -855,9 +855,9 @@ public: } const ValueFlow::Value * getMovedValue() const { - if (!_values) + if (!mValues) return nullptr; - for (std::list::const_iterator it = _values->begin(); it != _values->end(); ++it) { + for (std::list::const_iterator it = mValues->begin(); it != mValues->end(); ++it) { if (it->isMovedValue() && it->moveKind != ValueFlow::Value::NonMovedVariable) return &(*it); } @@ -1000,7 +1000,7 @@ private: ValueType *mValueType; // ValueFlow - std::list* _values; + std::list* mValues; static const std::list emptyValueList; public: @@ -1037,8 +1037,8 @@ public: } void clearValueFlow() { - delete _values; - _values = nullptr; + delete mValues; + mValues = nullptr; } std::string astString(const char *sep = "") const {