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

John McCall rjmccall at apple.com
Tue Oct 5 17:23:35 PDT 2010


Author: rjmccall
Date: Tue Oct  5 19:23:35 2010
New Revision: 115724

URL: http://llvm.org/viewvc/llvm-project?rev=115724&view=rev
Log:
Use a more conventional/efficient implementation for isEnumeralType()
and isBuiltinType().


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

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=115724&r1=115723&r2=115724&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Tue Oct  5 19:23:35 2010
@@ -3541,9 +3541,15 @@
 inline bool Type::isDependentSizedArrayType() const {
   return isa<DependentSizedArrayType>(CanonicalType);
 }
+inline bool Type::isBuiltinType() const {
+  return isa<BuiltinType>(CanonicalType);
+}
 inline bool Type::isRecordType() const {
   return isa<RecordType>(CanonicalType);
 }
+inline bool Type::isEnumeralType() const {
+  return isa<EnumType>(CanonicalType);
+}
 inline bool Type::isAnyComplexType() const {
   return isa<ComplexType>(CanonicalType);
 }
@@ -3596,10 +3602,6 @@
   return isa<TemplateTypeParmType>(CanonicalType);
 }
 
-inline bool Type::isBuiltinType() const {
-  return getAs<BuiltinType>();
-}
-
 inline bool Type::isSpecificBuiltinType(unsigned K) const {
   if (const BuiltinType *BT = getAs<BuiltinType>())
     if (BT->getKind() == (BuiltinType::Kind) K)

Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=115724&r1=115723&r2=115724&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Tue Oct  5 19:23:35 2010
@@ -470,12 +470,6 @@
   return false;  
 }
 
-bool Type::isEnumeralType() const {
-  if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
-    return TT->getDecl()->isEnum();
-  return false;
-}
-
 bool Type::isBooleanType() const {
   if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType))
     return BT->getKind() == BuiltinType::Bool;





More information about the cfe-commits mailing list