aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-10-06 00:23:35 +0000
committerJohn McCall <rjmccall@apple.com>2010-10-06 00:23:35 +0000
commitf449926a018a937549ebbe8045293b42aae9d6fd (patch)
treebeece28ad776b8b11bd4822b12c275b765d83220
parentb292e32fd252ce719f2649b3ba37547647c8a2ee (diff)
downloadllvm-f449926a018a937549ebbe8045293b42aae9d6fd.zip
llvm-f449926a018a937549ebbe8045293b42aae9d6fd.tar.gz
llvm-f449926a018a937549ebbe8045293b42aae9d6fd.tar.bz2
Use a more conventional/efficient implementation for isEnumeralType()
and isBuiltinType(). llvm-svn: 115724
-rw-r--r--clang/include/clang/AST/Type.h10
-rw-r--r--clang/lib/AST/Type.cpp6
2 files changed, 6 insertions, 10 deletions
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 9b32836..3cd60d3 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -3541,9 +3541,15 @@ inline bool Type::isVariableArrayType() const {
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 @@ inline bool Type::isTemplateTypeParmType() const {
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)
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 8e6aa23..61390c8 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -470,12 +470,6 @@ bool Type::isIntegralOrEnumerationType() const {
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;