Merge ichecker branch changes into the mainline. New project can be found under src/tools/ICheck

This commit is contained in:
Wolfgang Beck
2010-01-19 15:26:08 +10:00
parent 29b7594b38
commit 4b33881729
33 changed files with 2915 additions and 93 deletions

View File

@@ -221,6 +221,10 @@ bool Function::isEqualTo(const Type *other) const
return false;
else if (isVolatile() != o->isVolatile())
return false;
#ifdef ICHECK_BUILD
else if (isInvokable() != o->isInvokable())
return false;
#endif
const Name *l = identity();
const Name *r = o->identity();
@@ -240,6 +244,35 @@ bool Function::isEqualTo(const Type *other) const
return false;
}
#ifdef ICHECK_BUILD
bool Function::isEqualTo(const Function* fct, bool ignoreName/* = false*/) const
{
if(!ignoreName)
return isEqualTo((Type*)fct);
if (! fct)
return false;
else if (isConst() != fct->isConst())
return false;
else if (isVolatile() != fct->isVolatile())
return false;
else if (isInvokable() != fct->isInvokable())
return false;
if (_arguments->symbolCount() != fct->_arguments->symbolCount())
return false;
else if (! _returnType.isEqualTo(fct->_returnType))
return false;
for (unsigned i = 0; i < _arguments->symbolCount(); ++i) {
Symbol *l = _arguments->symbolAt(i);
Symbol *r = fct->_arguments->symbolAt(i);
if (! l->type().isEqualTo(r->type()))
return false;
}
return true;
}
#endif
void Function::accept0(TypeVisitor *visitor)
{ visitor->visit(this); }
@@ -316,6 +349,16 @@ bool Function::isPureVirtual() const
void Function::setPureVirtual(bool isPureVirtual)
{ f._isPureVirtual = isPureVirtual; }
#ifdef ICHECK_BUILD
bool Function::isInvokable() const
{ return f._isInvokable == 1; }
void Function::setInvokable(bool isInvokable)
{ f._isInvokable = isInvokable; }
#endif
bool Function::isAmbiguous() const
{ return f._isAmbiguous; }