Submitted by:
Reviewed by:
Carbon.h now compiles without error!

All 14 errors were the result of two Type predicates (isArithmeticType
and isScalarType) not allowing enums. Note: this could have been avoided by rigorously using
isIntegerType. For efficiency, I decided not to have predicates use predicates.

Still more work to do, however this is a nice milestone considering how much "work" is being done...

llvm-svn: 39417
This commit is contained in:
Steve Naroff 2007-04-26 21:44:56 +00:00
parent ae4143ea90
commit 1cbdf71d2e
2 changed files with 7 additions and 1 deletions

View File

@ -130,6 +130,9 @@ bool Type::isArithmeticType() const {
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
return BT->getKind() >= BuiltinType::Bool &&
BT->getKind() <= BuiltinType::LongDoubleComplex;
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
if (TT->getDecl()->getKind() == Decl::Enum)
return true;
return false;
}
@ -137,6 +140,9 @@ bool Type::isScalarType() const {
if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
return BT->getKind() >= BuiltinType::Bool &&
BT->getKind() <= BuiltinType::LongDoubleComplex;
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
if (TT->getDecl()->getKind() == Decl::Enum)
return true;
return CanonicalType->getTypeClass() == Pointer;
}

View File

@ -214,7 +214,7 @@ public:
bool isComplexType() const; // C99 6.2.5p11 (complex)
bool isFloatingType() const; // C99 6.2.5p11 (real floating + complex)
bool isRealType() const; // C99 6.2.5p17 (real floating + integer)
bool isArithmeticType() const; // C99 6.2.5p18 (integral + floating)
bool isArithmeticType() const; // C99 6.2.5p18 (integer + floating)
bool isVoidType() const; // C99 6.2.5p19
/// Derived types (C99 6.2.5p20). isFunctionType() is also a derived type.