Fixed #5767 (move bool Variable flag into flag variable)

This commit is contained in:
Robert Reif 2014-05-07 15:59:21 +02:00 committed by Daniel Marjamäki
parent 5ad3ac2653
commit 0bdecfd9cb
2 changed files with 7 additions and 9 deletions

View File

@ -1174,7 +1174,7 @@ void Variable::evaluate()
setFlag(fIsArray, arrayDimensions(_dimensions, _name->next())); setFlag(fIsArray, arrayDimensions(_dimensions, _name->next()));
if (_start) { if (_start) {
setFlag(fIsClass, !_start->isStandardType() && !isPointer() && !isReference()); setFlag(fIsClass, !_start->isStandardType() && !isPointer() && !isReference());
_stlType = Token::simpleMatch(_start, "std ::"); setFlag(fIsStlType, Token::simpleMatch(_start, "std ::"));
} }
if (_access == Argument) { if (_access == Argument) {
tok = _name; 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 << " isReference: " << (var->isReference() ? "true" : "false") << std::endl;
std::cout << indent << " isRValueRef: " << (var->isRValueReference() ? "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 << " hasDefault: " << (var->hasDefault() ? "true" : "false") << std::endl;
std::cout << indent << " isStlType: " << (var->isStlType() ? "true" : "false") << std::endl;
std::cout << indent << "_type: "; std::cout << indent << "_type: ";
if (var->type()) { if (var->type()) {
std::cout << var->type()->name(); std::cout << var->type()->name();

View File

@ -134,7 +134,8 @@ class CPPCHECKLIB Variable {
fIsPointer = (1 << 6), /** @brief pointer variable */ fIsPointer = (1 << 6), /** @brief pointer variable */
fIsReference = (1 << 7), /** @brief reference variable */ fIsReference = (1 << 7), /** @brief reference variable */
fIsRValueRef = (1 << 8), /** @brief rvalue 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_), _access(access_),
_flags(0), _flags(0),
_type(type_), _type(type_),
_scope(scope_), _scope(scope_) {
_stlType(false) {
evaluate(); evaluate();
} }
@ -454,7 +454,7 @@ public:
* @return true if it is an stl type and its type matches any of the types in 'stlTypes' * @return true if it is an stl type and its type matches any of the types in 'stlTypes'
*/ */
bool isStlType() const { bool isStlType() const {
return _stlType; return getFlag(fIsStlType);
} }
/** /**
@ -469,7 +469,7 @@ public:
*/ */
template <std::size_t array_length> template <std::size_t array_length>
bool isStlType(const char* const(&stlTypes)[array_length]) const { 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: private:
@ -511,9 +511,6 @@ private:
/** @brief array dimensions */ /** @brief array dimensions */
std::vector<Dimension> _dimensions; std::vector<Dimension> _dimensions;
/** @brief true if variable is of STL type */
bool _stlType;
/** @brief fill in information, depending on Tokens given at instantiation */ /** @brief fill in information, depending on Tokens given at instantiation */
void evaluate(); void evaluate();
}; };