[cfe-commits] r39417 - in /cfe/cfe/trunk: AST/Type.cpp include/clang/AST/Type.h

Steve Naroff snaroff at apple.com
Wed Jul 11 09:44:08 PDT 2007


Author: snaroff
Date: Wed Jul 11 11:44:08 2007
New Revision: 39417

URL: http://llvm.org/viewvc/llvm-project?rev=39417&view=rev
Log:
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...

Modified:
    cfe/cfe/trunk/AST/Type.cpp
    cfe/cfe/trunk/include/clang/AST/Type.h

Modified: cfe/cfe/trunk/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Type.cpp?rev=39417&r1=39416&r2=39417&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Type.cpp (original)
+++ cfe/cfe/trunk/AST/Type.cpp Wed Jul 11 11:44:08 2007
@@ -130,6 +130,9 @@
   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 @@
   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;
 }
 

Modified: cfe/cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Type.h?rev=39417&r1=39416&r2=39417&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Type.h Wed Jul 11 11:44:08 2007
@@ -214,7 +214,7 @@
   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.





More information about the cfe-commits mailing list