From 1cbdf71d2ed59eb3ab714519742205797df33502 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Thu, 26 Apr 2007 21:44:56 +0000 Subject: [PATCH] Bug #: 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 --- clang/AST/Type.cpp | 6 ++++++ clang/include/clang/AST/Type.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/clang/AST/Type.cpp b/clang/AST/Type.cpp index 0685e811d50e..c0defda16690 100644 --- a/clang/AST/Type.cpp +++ b/clang/AST/Type.cpp @@ -130,6 +130,9 @@ bool Type::isArithmeticType() const { if (const BuiltinType *BT = dyn_cast(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::LongDoubleComplex; + if (const TagType *TT = dyn_cast(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(CanonicalType)) return BT->getKind() >= BuiltinType::Bool && BT->getKind() <= BuiltinType::LongDoubleComplex; + if (const TagType *TT = dyn_cast(CanonicalType)) + if (TT->getDecl()->getKind() == Decl::Enum) + return true; return CanonicalType->getTypeClass() == Pointer; } diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index e199b09dfefb..7a52c2421174 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -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.