ValueType: Support integers defined in libraries (#7394)

This commit is contained in:
PKEuS 2016-05-04 15:39:56 +02:00
parent 6c3f0a7bb8
commit 0bf85f9aa5
6 changed files with 75 additions and 82 deletions

View File

@ -1600,7 +1600,7 @@ void CheckOther::checkZeroDivision()
if (MathLib::isFloat(tok->astOperand1()->str()))
continue;
} else if (tok->astOperand1()->isName()) {
if (tok->astOperand1()->variable() && !tok->astOperand1()->variable()->isIntegralType())
if (!tok->astOperand1()->valueType()->isIntegral())
continue;
} else if (!tok->astOperand1()->isArithmeticalOp())
continue;

View File

@ -1591,9 +1591,7 @@ void Variable::evaluate(const Library* lib)
}
if (_start) {
if (Token::Match(_start, "bool|char|short|int|long"))
setFlag(fIsIntType, true);
else if (Token::Match(_start, "float|double"))
if (Token::Match(_start, "float|double"))
setFlag(fIsFloatType, true);
}
}
@ -4035,30 +4033,30 @@ bool SymbolDatabase::isReservedName(const std::string& iName) const
return c_keywords.find(iName) != c_keywords.cend();
}
static const Token * parsedecl(const Token *type, ValueType * const valuetype, ValueType::Sign defaultSignedness);
static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, ValueType::Sign defaultSignedness);
static const Token * parsedecl(const Token *type, ValueType * const valuetype, ValueType::Sign defaultSignedness, const Library* lib);
static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, ValueType::Sign defaultSignedness, const Library* lib);
static void setValueType(Token *tok, const Variable &var, bool cpp, ValueType::Sign defaultSignedness)
static void setValueType(Token *tok, const Variable &var, bool cpp, ValueType::Sign defaultSignedness, const Library* lib)
{
ValueType valuetype;
valuetype.pointer = var.dimensions().size();
valuetype.typeScope = var.typeScope();
if (var.isEnumType()) {
if (var.type() && var.type()->classScope && var.type()->classScope->enumType) {
if (parsedecl(var.type()->classScope->enumType, &valuetype, defaultSignedness)) {
setValueType(tok, valuetype, cpp, defaultSignedness);
if (parsedecl(var.type()->classScope->enumType, &valuetype, defaultSignedness, lib)) {
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
valuetype.originalTypeName = var.type()->classScope->className;
}
} else {
valuetype.sign = ValueType::SIGNED;
valuetype.type = ValueType::INT;
setValueType(tok, valuetype, cpp, defaultSignedness);
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
}
} else if (parsedecl(var.typeStartToken(), &valuetype, defaultSignedness))
setValueType(tok, valuetype, cpp, defaultSignedness);
} else if (parsedecl(var.typeStartToken(), &valuetype, defaultSignedness, lib))
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
}
static void setValueType(Token *tok, const Enumerator &enumerator, bool cpp, ValueType::Sign defaultSignedness)
static void setValueType(Token *tok, const Enumerator &enumerator, bool cpp, ValueType::Sign defaultSignedness, const Library* lib)
{
ValueType valuetype;
valuetype.typeScope = enumerator.scope;
@ -4079,16 +4077,23 @@ static void setValueType(Token *tok, const Enumerator &enumerator, bool cpp, Val
valuetype.type = ValueType::Type::INT;
else if (type->str() == "long")
valuetype.type = type->isLong() ? ValueType::Type::LONGLONG : ValueType::Type::LONG;
else if (type->isStandardType()) {
const Library::PodType* podtype = lib->podtype(type->str());
if (podtype && (podtype->sign == 's' || podtype->sign == 'u')) {
valuetype.type = ValueType::Type::UNKNOWN_INT;
valuetype.sign = (podtype->sign == 'u') ? ValueType::UNSIGNED : ValueType::SIGNED;
}
}
setValueType(tok, valuetype, cpp, defaultSignedness);
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
} else {
valuetype.sign = ValueType::SIGNED;
valuetype.type = ValueType::INT;
setValueType(tok, valuetype, cpp, defaultSignedness);
setValueType(tok, valuetype, cpp, defaultSignedness, lib);
}
}
static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, ValueType::Sign defaultSignedness)
static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, ValueType::Sign defaultSignedness, const Library* lib)
{
tok->setValueType(new ValueType(valuetype));
Token *parent = const_cast<Token *>(tok->astParent());
@ -4102,32 +4107,32 @@ static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, Value
if (vt1 && Token::Match(parent, "<<|>>")) {
if (!cpp || (vt2 && vt2->isIntegral()))
setValueType(parent, *vt1, cpp, defaultSignedness);
setValueType(parent, *vt1, cpp, defaultSignedness, lib);
return;
}
if (parent->isAssignmentOp()) {
if (vt1)
setValueType(parent, *vt1, cpp, defaultSignedness);
setValueType(parent, *vt1, cpp, defaultSignedness, lib);
return;
}
if (parent->str() == "[" && valuetype.pointer > 0U) {
ValueType vt(valuetype);
vt.pointer -= 1U;
setValueType(parent, vt, cpp, defaultSignedness);
setValueType(parent, vt, cpp, defaultSignedness, lib);
return;
}
if (parent->str() == "*" && !parent->astOperand2() && valuetype.pointer > 0U) {
ValueType vt(valuetype);
vt.pointer -= 1U;
setValueType(parent, vt, cpp, defaultSignedness);
setValueType(parent, vt, cpp, defaultSignedness, lib);
return;
}
if (parent->str() == "&" && !parent->astOperand2()) {
ValueType vt(valuetype);
vt.pointer += 1U;
setValueType(parent, vt, cpp, defaultSignedness);
setValueType(parent, vt, cpp, defaultSignedness, lib);
return;
}
@ -4147,7 +4152,7 @@ static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, Value
}
}
if (var)
setValueType(parent, *var, cpp, defaultSignedness);
setValueType(parent, *var, cpp, defaultSignedness, lib);
return;
}
@ -4162,33 +4167,33 @@ static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, Value
if (ternary || parent->isArithmeticalOp() || parent->tokType() == Token::eIncDecOp) {
if (vt1->pointer != 0U && vt2 && vt2->pointer == 0U) {
setValueType(parent, *vt1, cpp, defaultSignedness);
setValueType(parent, *vt1, cpp, defaultSignedness, lib);
return;
}
if (vt1->pointer == 0U && vt2 && vt2->pointer != 0U) {
setValueType(parent, *vt2, cpp, defaultSignedness);
setValueType(parent, *vt2, cpp, defaultSignedness, lib);
return;
}
if (vt1->pointer != 0U) {
if (ternary || parent->tokType() == Token::eIncDecOp) // result is pointer
setValueType(parent, *vt1, cpp, defaultSignedness);
setValueType(parent, *vt1, cpp, defaultSignedness, lib);
else // result is pointer diff
setValueType(parent, ValueType(ValueType::Sign::SIGNED, ValueType::Type::INT, 0U, 0U, "ptrdiff_t"), cpp, defaultSignedness);
setValueType(parent, ValueType(ValueType::Sign::SIGNED, ValueType::Type::INT, 0U, 0U, "ptrdiff_t"), cpp, defaultSignedness, lib);
return;
}
if (vt1->type == ValueType::Type::LONGDOUBLE || (vt2 && vt2->type == ValueType::Type::LONGDOUBLE)) {
setValueType(parent, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::LONGDOUBLE, 0U), cpp, defaultSignedness);
setValueType(parent, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::LONGDOUBLE, 0U), cpp, defaultSignedness, lib);
return;
}
if (vt1->type == ValueType::Type::DOUBLE || (vt2 && vt2->type == ValueType::Type::DOUBLE)) {
setValueType(parent, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::DOUBLE, 0U), cpp, defaultSignedness);
setValueType(parent, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::DOUBLE, 0U), cpp, defaultSignedness, lib);
return;
}
if (vt1->type == ValueType::Type::FLOAT || (vt2 && vt2->type == ValueType::Type::FLOAT)) {
setValueType(parent, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::FLOAT, 0U), cpp, defaultSignedness);
setValueType(parent, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::FLOAT, 0U), cpp, defaultSignedness, lib);
return;
}
}
@ -4222,12 +4227,12 @@ static void setValueType(Token *tok, const ValueType &valuetype, bool cpp, Value
vt.originalTypeName.clear();
}
setValueType(parent, vt, cpp, defaultSignedness);
setValueType(parent, vt, cpp, defaultSignedness, lib);
return;
}
}
static const Token * parsedecl(const Token *type, ValueType * const valuetype, ValueType::Sign defaultSignedness)
static const Token * parsedecl(const Token *type, ValueType * const valuetype, ValueType::Sign defaultSignedness, const Library* lib)
{
const unsigned int pointer0 = valuetype->pointer;
while (Token::Match(type->previous(), "%name%"))
@ -4263,6 +4268,13 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
return nullptr;
else if (type->str() == "*")
valuetype->pointer++;
else if (type->isStandardType()) {
const Library::PodType* podtype = lib->podtype(type->str());
if (podtype && (podtype->sign == 's' || podtype->sign == 'u')) {
valuetype->type = ValueType::Type::UNKNOWN_INT;
valuetype->sign = (podtype->sign == 'u') ? ValueType::UNSIGNED : ValueType::SIGNED;
}
}
if (!type->originalName().empty())
valuetype->originalTypeName = type->originalName();
type = type->next();
@ -4279,7 +4291,7 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
return (type && (valuetype->type != ValueType::Type::UNKNOWN_TYPE || valuetype->pointer > 0)) ? type : nullptr;
}
void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, char defaultSignedness)
void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, char defaultSignedness, const Library* lib)
{
ValueType::Sign defsign;
if (defaultSignedness == 's' || defaultSignedness == 'S')
@ -4299,7 +4311,7 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, char defau
const char suffix = tok->str()[tok->str().size() - 1U];
if (suffix == 'f' || suffix == 'F')
type = ValueType::Type::FLOAT;
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, type, 0U), cpp, defsign);
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, type, 0U), cpp, defsign, lib);
} else if (MathLib::isInt(tok->str())) {
ValueType::Sign sign = ValueType::Sign::SIGNED;
ValueType::Type type = ValueType::Type::INT;
@ -4312,51 +4324,51 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens, bool cpp, char defau
if (suffix == 'l' || suffix == 'L')
type = (type == ValueType::Type::INT) ? ValueType::Type::LONG : ValueType::Type::LONGLONG;
}
::setValueType(tok, ValueType(sign, type, 0U), cpp, defsign);
::setValueType(tok, ValueType(sign, type, 0U), cpp, defsign, lib);
}
} else if (tok->isComparisonOp() || tok->tokType() == Token::eLogicalOp)
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::BOOL, 0U), cpp, defsign);
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::BOOL, 0U), cpp, defsign, lib);
else if (tok->tokType() == Token::eChar)
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::CHAR, 0U), cpp, defsign);
::setValueType(tok, ValueType(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::CHAR, 0U), cpp, defsign, lib);
else if (tok->tokType() == Token::eString) {
ValueType valuetype(ValueType::Sign::UNKNOWN_SIGN, ValueType::Type::CHAR, 1U, 1U);
if (tok->isLong()) {
valuetype.originalTypeName = "wchar_t";
valuetype.type = ValueType::Type::SHORT;
}
::setValueType(tok, valuetype, cpp, defsign);
::setValueType(tok, valuetype, cpp, defsign, lib);
} else if (tok->str() == "(") {
// cast
if (!tok->astOperand2() && Token::Match(tok, "( %name%")) {
ValueType valuetype;
if (Token::simpleMatch(parsedecl(tok->next(), &valuetype, defsign), ")"))
::setValueType(tok, valuetype, cpp, defsign);
if (Token::simpleMatch(parsedecl(tok->next(), &valuetype, defsign, lib), ")"))
::setValueType(tok, valuetype, cpp, defsign, lib);
}
// C++ cast
if (tok->astOperand2() && Token::Match(tok->astOperand1(), "static_cast|const_cast|dynamic_cast|reinterpret_cast < %name%") && tok->astOperand1()->linkAt(1)) {
ValueType valuetype;
if (Token::simpleMatch(parsedecl(tok->astOperand1()->tokAt(2), &valuetype, defsign), ">"))
::setValueType(tok, valuetype, cpp, defsign);
if (Token::simpleMatch(parsedecl(tok->astOperand1()->tokAt(2), &valuetype, defsign, lib), ">"))
::setValueType(tok, valuetype, cpp, defsign, lib);
}
// function
else if (tok->previous() && tok->previous()->function() && tok->previous()->function()->retDef) {
ValueType valuetype;
if (Token::simpleMatch(parsedecl(tok->previous()->function()->retDef, &valuetype, defsign), "("))
::setValueType(tok, valuetype, cpp, defsign);
if (Token::simpleMatch(parsedecl(tok->previous()->function()->retDef, &valuetype, defsign, lib), "("))
::setValueType(tok, valuetype, cpp, defsign, lib);
}
else if (Token::simpleMatch(tok->previous(), "sizeof (")) {
// TODO: use specified size_t type
ValueType valuetype(ValueType::Sign::UNSIGNED, ValueType::Type::LONG, 0U);
valuetype.originalTypeName = "size_t";
setValueType(tok, valuetype, cpp, defsign);
setValueType(tok, valuetype, cpp, defsign, lib);
}
} else if (tok->variable()) {
setValueType(tok, *tok->variable(), cpp, defsign);
setValueType(tok, *tok->variable(), cpp, defsign, lib);
} else if (tok->enumerator()) {
setValueType(tok, *tok->enumerator(), cpp, defsign);
setValueType(tok, *tok->enumerator(), cpp, defsign, lib);
}
}
}
@ -4407,6 +4419,8 @@ std::string ValueType::str() const
ret += " long";
else if (type == LONGLONG)
ret += " long long";
else if (type == UNKNOWN_INT)
ret += " unknown_int";
} else if (type == FLOAT)
ret += " float";
else if (type == DOUBLE)

View File

@ -159,8 +159,7 @@ class CPPCHECKLIB Variable {
fHasDefault = (1 << 9), /** @brief function argument with default value */
fIsStlType = (1 << 10), /** @brief STL type ('std::') */
fIsStlString = (1 << 11), /** @brief std::string|wstring|basic_string&lt;T&gt;|u16string|u32string */
fIsIntType = (1 << 12), /** @brief Integral type */
fIsFloatType = (1 << 13) /** @brief Floating point type */
fIsFloatType = (1 << 12) /** @brief Floating point type */
};
/**
@ -550,14 +549,6 @@ public:
return getFlag(fIsFloatType);
}
/**
* Determine whether it's an integral number type
* @return true if the type is known and it's an integral type (bool, char, short, int, long long and their unsigned counter parts) or a pointer/array to it
*/
bool isIntegralType() const {
return getFlag(fIsIntType);
}
/**
* Determine whether it's an enumeration type
* @return true if the type is known and it's an enumeration type
@ -1068,7 +1059,7 @@ public:
void validateVariables() const;
/** Set valuetype in provided tokenlist */
static void setValueTypeInTokenList(Token *tokens, bool cpp, char defaultSignedness);
static void setValueTypeInTokenList(Token *tokens, bool cpp, char defaultSignedness, const Library* lib);
void debugValueType() const;
@ -1105,7 +1096,7 @@ private:
class CPPCHECKLIB ValueType {
public:
enum Sign {UNKNOWN_SIGN, SIGNED, UNSIGNED} sign;
enum Type {UNKNOWN_TYPE, NONSTD, VOID, BOOL, CHAR, SHORT, INT, LONG, LONGLONG, FLOAT, DOUBLE, LONGDOUBLE} type;
enum Type {UNKNOWN_TYPE, NONSTD, VOID, BOOL, CHAR, SHORT, INT, LONG, LONGLONG, UNKNOWN_INT, FLOAT, DOUBLE, LONGDOUBLE} type;
unsigned int pointer; // 0=>not pointer, 1=>*, 2=>**, 3=>***, etc
unsigned int constness; // bit 0=data, bit 1=*, bit 2=**
const Scope *typeScope;
@ -1118,7 +1109,7 @@ public:
ValueType(enum Sign s, enum Type t, unsigned int p, unsigned int c, const std::string &otn) : sign(s), type(t), pointer(p), constness(c), typeScope(nullptr), originalTypeName(otn) {}
bool isIntegral() const {
return (type >= ValueType::Type::BOOL && type <= ValueType::Type::LONGLONG);
return (type >= ValueType::Type::BOOL && type <= ValueType::Type::UNKNOWN_INT);
}
std::string str() const;

View File

@ -1713,7 +1713,7 @@ bool Tokenizer::simplifyTokens1(const std::string &configuration,
list.createAst();
list.validateAst();
SymbolDatabase::setValueTypeInTokenList(list.front(), isCPP(), _settings->defaultSign);
SymbolDatabase::setValueTypeInTokenList(list.front(), isCPP(), _settings->defaultSign, &_settings->library);
ValueFlow::setValues(&list, _symbolDatabase, _errorLogger, _settings);
}

View File

@ -31,7 +31,12 @@ public:
}
private:
Settings _settings;
void run() {
LOAD_LIB_2(_settings.library, "std.cfg");
TEST_CASE(emptyBrackets);
TEST_CASE(zeroDiv1);
@ -172,7 +177,6 @@ private:
errout.str("");
if (!settings) {
static Settings _settings;
settings = &_settings;
}
settings->addEnabled("style");
@ -314,6 +318,11 @@ private:
" i %= 0;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (error) Division by zero.\n", errout.str());
check("uint8_t foo(uint8_t i) {\n"
" return i / 0;\n"
"}");
ASSERT_EQUALS("[test.cpp:2]: (error) Division by zero.\n", errout.str());
}
void zeroDiv4() {

View File

@ -338,7 +338,6 @@ private:
ASSERT(false == v.isArray());
ASSERT(false == v.isPointer());
ASSERT(false == v.isReference());
ASSERT(true == v.isIntegralType());
}
void test_isVariableDeclarationIdentifiesCpp11Initialization() {
@ -352,7 +351,6 @@ private:
ASSERT(false == v.isArray());
ASSERT(false == v.isPointer());
ASSERT(false == v.isReference());
ASSERT(true == v.isIntegralType());
}
void test_isVariableDeclarationIdentifiesScopedDeclaration() {
@ -2925,77 +2923,66 @@ private:
ASSERT(b != nullptr);
if (b) {
ASSERT_EQUALS("b", b->nameToken()->str());
ASSERT_EQUALS(true, b->isIntegralType());
ASSERT_EQUALS(false, b->isFloatingType());
}
const Variable *c = db->getVariableFromVarId(2);
ASSERT(c != nullptr);
if (c) {
ASSERT_EQUALS("c", c->nameToken()->str());
ASSERT_EQUALS(true, c->isIntegralType());
ASSERT_EQUALS(false, c->isFloatingType());
}
const Variable *uc = db->getVariableFromVarId(3);
ASSERT(uc != nullptr);
if (uc) {
ASSERT_EQUALS("uc", uc->nameToken()->str());
ASSERT_EQUALS(true, uc->isIntegralType());
ASSERT_EQUALS(false, uc->isFloatingType());
}
const Variable *s = db->getVariableFromVarId(4);
ASSERT(s != nullptr);
if (s) {
ASSERT_EQUALS("s", s->nameToken()->str());
ASSERT_EQUALS(true, s->isIntegralType());
ASSERT_EQUALS(false, s->isFloatingType());
}
const Variable *us = db->getVariableFromVarId(5);
ASSERT(us != nullptr);
if (us) {
ASSERT_EQUALS("us", us->nameToken()->str());
ASSERT_EQUALS(true, us->isIntegralType());
ASSERT_EQUALS(false, us->isFloatingType());
}
const Variable *i = db->getVariableFromVarId(6);
ASSERT(i != nullptr);
if (i) {
ASSERT_EQUALS("i", i->nameToken()->str());
ASSERT_EQUALS(true, i->isIntegralType());
ASSERT_EQUALS(false, i->isFloatingType());
}
const Variable *u = db->getVariableFromVarId(7);
ASSERT(u != nullptr);
if (u) {
ASSERT_EQUALS("u", u->nameToken()->str());
ASSERT_EQUALS(true, u->isIntegralType());
ASSERT_EQUALS(false, u->isFloatingType());
}
const Variable *ui = db->getVariableFromVarId(8);
ASSERT(ui != nullptr);
if (ui) {
ASSERT_EQUALS("ui", ui->nameToken()->str());
ASSERT_EQUALS(true, ui->isIntegralType());
ASSERT_EQUALS(false, ui->isFloatingType());
}
const Variable *l = db->getVariableFromVarId(9);
ASSERT(l != nullptr);
if (l) {
ASSERT_EQUALS("l", l->nameToken()->str());
ASSERT_EQUALS(true, l->isIntegralType());
ASSERT_EQUALS(false, l->isFloatingType());
}
const Variable *ul = db->getVariableFromVarId(10);
ASSERT(ul != nullptr);
if (ul) {
ASSERT_EQUALS("ul", ul->nameToken()->str());
ASSERT_EQUALS(true, ul->isIntegralType());
ASSERT_EQUALS(false, ul->isFloatingType());
}
const Variable *ll = db->getVariableFromVarId(11);
ASSERT(ll != nullptr);
if (ll) {
ASSERT_EQUALS("ll", ll->nameToken()->str());
ASSERT_EQUALS(true, ll->isIntegralType());
ASSERT_EQUALS(false, ll->isFloatingType());
}
}
@ -3007,21 +2994,18 @@ private:
ASSERT(f != nullptr);
if (f) {
ASSERT_EQUALS("f", f->nameToken()->str());
ASSERT_EQUALS(false, f->isIntegralType());
ASSERT_EQUALS(true, f->isFloatingType());
}
const Variable *d = db->getVariableFromVarId(2);
ASSERT(d != nullptr);
if (d) {
ASSERT_EQUALS("d", d->nameToken()->str());
ASSERT_EQUALS(false, d->isIntegralType());
ASSERT_EQUALS(true, d->isFloatingType());
}
const Variable *ld = db->getVariableFromVarId(3);
ASSERT(ld != nullptr);
if (ld) {
ASSERT_EQUALS("ld", ld->nameToken()->str());
ASSERT_EQUALS(false, ld->isIntegralType());
ASSERT_EQUALS(true, ld->isFloatingType());
}
}
@ -3031,7 +3015,6 @@ private:
ASSERT(f != nullptr);
if (f) {
ASSERT_EQUALS("f", f->nameToken()->str());
ASSERT_EQUALS(false, f->isIntegralType());
ASSERT_EQUALS(true, f->isFloatingType());
ASSERT_EQUALS(true, f->isArrayOrPointer());
}
@ -3039,7 +3022,6 @@ private:
ASSERT(scf != nullptr);
if (scf) {
ASSERT_EQUALS("scf", scf->nameToken()->str());
ASSERT_EQUALS(false, scf->isIntegralType());
ASSERT_EQUALS(true, scf->isFloatingType());
ASSERT_EQUALS(true, scf->isArrayOrPointer());
}
@ -3050,7 +3032,6 @@ private:
ASSERT(fa != nullptr);
if (fa) {
ASSERT_EQUALS("fa", fa->nameToken()->str());
ASSERT_EQUALS(false, fa->isIntegralType());
ASSERT_EQUALS(true, fa->isFloatingType());
ASSERT_EQUALS(true, fa->isArrayOrPointer());
}
@ -3063,14 +3044,12 @@ private:
ASSERT(a != nullptr);
if (a) {
ASSERT_EQUALS("a", a->nameToken()->str());
ASSERT_EQUALS(false, a->isIntegralType());
ASSERT_EQUALS(false, a->isFloatingType());
}
const Variable *b = db->getVariableFromVarId(2);
ASSERT(b != nullptr);
if (b) {
ASSERT_EQUALS("b", b->nameToken()->str());
ASSERT_EQUALS(false, b->isIntegralType());
ASSERT_EQUALS(false, b->isFloatingType());
}
}