MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / setValueType

Method setValueType

lib/symboldatabase.cpp:2651–2667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2649}
2650
2651void Variable::setValueType(const ValueType &vt)
2652{
2653 if (vt.type == ValueType::Type::UNKNOWN_TYPE) {
2654 const Token *declType = Token::findsimplematch(mTypeStartToken, "decltype (", mTypeEndToken);
2655 if (declType && !declType->next()->valueType())
2656 return;
2657 }
2658 const auto* tmp = new ValueType(vt);
2659 delete mValueType;
2660 mValueType = tmp;
2661 if ((mValueType->pointer > 0) && (!isArray() || Token::Match(mNameToken->previous(), "( * %name% )")))
2662 setFlag(fIsPointer, true);
2663 setFlag(fIsConst, mValueType->constness & (1U << mValueType->pointer));
2664 setFlag(fIsVolatile, mValueType->volatileness & (1U << mValueType->pointer));
2665 if (mValueType->smartPointerType)
2666 setFlag(fIsSmartPointer, true);
2667}
2668
2669const Type* Variable::smartPointerType() const
2670{

Calls 15

findsimplematchFunction · 0.85
isArrayFunction · 0.85
parsedeclFunction · 0.85
getEnumTypeFunction · 0.85
isContainerYieldElementFunction · 0.85
isContainerYieldPointerFunction · 0.85
setAutoTokenPropertiesFunction · 0.85
nextMethod · 0.80
setDebugPathMethod · 0.80
smartPointerTypeMethod · 0.80
astOperand1Method · 0.80
isArrayMethod · 0.80

Tested by

no test coverage detected