From 0bdecfd9cb2f675d61bdb5ab953972dcc7d1b9ed Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Wed, 7 May 2014 15:59:21 +0200 Subject: [PATCH] Fixed #5767 (move bool Variable flag into flag variable) --- lib/symboldatabase.cpp | 3 ++- lib/symboldatabase.h | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index feed04699..ebc668c1d 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -1174,7 +1174,7 @@ void Variable::evaluate() setFlag(fIsArray, arrayDimensions(_dimensions, _name->next())); if (_start) { setFlag(fIsClass, !_start->isStandardType() && !isPointer() && !isReference()); - _stlType = Token::simpleMatch(_start, "std ::"); + setFlag(fIsStlType, Token::simpleMatch(_start, "std ::")); } if (_access == Argument) { tok = _name; @@ -1828,6 +1828,7 @@ void SymbolDatabase::printVariable(const Variable *var, const char *indent) cons std::cout << indent << " isReference: " << (var->isReference() ? "true" : "false") << std::endl; std::cout << indent << " isRValueRef: " << (var->isRValueReference() ? "true" : "false") << std::endl; std::cout << indent << " hasDefault: " << (var->hasDefault() ? "true" : "false") << std::endl; + std::cout << indent << " isStlType: " << (var->isStlType() ? "true" : "false") << std::endl; std::cout << indent << "_type: "; if (var->type()) { std::cout << var->type()->name(); diff --git a/lib/symboldatabase.h b/lib/symboldatabase.h index 3d3e128a9..06cd5f6d3 100644 --- a/lib/symboldatabase.h +++ b/lib/symboldatabase.h @@ -134,7 +134,8 @@ class CPPCHECKLIB Variable { fIsPointer = (1 << 6), /** @brief pointer variable */ fIsReference = (1 << 7), /** @brief reference variable */ fIsRValueRef = (1 << 8), /** @brief rvalue reference variable */ - fHasDefault = (1 << 9) /** @brief function argument with default value */ + fHasDefault = (1 << 9), /** @brief function argument with default value */ + fIsStlType = (1 << 10) /** @brief STL type ('std::') */ }; /** @@ -174,8 +175,7 @@ public: _access(access_), _flags(0), _type(type_), - _scope(scope_), - _stlType(false) { + _scope(scope_) { evaluate(); } @@ -454,7 +454,7 @@ public: * @return true if it is an stl type and its type matches any of the types in 'stlTypes' */ bool isStlType() const { - return _stlType; + return getFlag(fIsStlType); } /** @@ -469,7 +469,7 @@ public: */ template bool isStlType(const char* const(&stlTypes)[array_length]) const { - return _stlType && std::binary_search(stlTypes, stlTypes + array_length, _start->strAt(2)); + return isStlType() && std::binary_search(stlTypes, stlTypes + array_length, _start->strAt(2)); } private: @@ -511,9 +511,6 @@ private: /** @brief array dimensions */ std::vector _dimensions; - /** @brief true if variable is of STL type */ - bool _stlType; - /** @brief fill in information, depending on Tokens given at instantiation */ void evaluate(); };