diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-06-16 00:17:44 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-06-16 00:17:44 +0000 |
commit | 2ade35e2cfd554e49d35a52047cea98a82787af9 (patch) | |
tree | b3d261cde2d8f15007d53bd5f103ab6d1b75a595 /lib/AST/Type.cpp | |
parent | ff2d05f653948e4bb2877c210f9fa7a2888ceb5c (diff) |
Introduce Type::isIntegralOrEnumerationType(), to cover those places
in C++ that involve both integral and enumeration types. Convert all
of the callers to Type::isIntegralType() that are meant to work with
both integral and enumeration types over to
Type::isIntegralOrEnumerationType(), to prepare to eliminate
enumeration types as integral types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106071 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 1d91e76c8f..92fffd1881 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -450,6 +450,17 @@ bool Type::isIntegralType() const { return false; } +bool Type::isIntegralOrEnumerationType() const { + if (const BuiltinType *BT = dyn_cast<BuiltinType>(CanonicalType)) + return BT->getKind() >= BuiltinType::Bool && + BT->getKind() <= BuiltinType::Int128; + + if (isa<EnumType>(CanonicalType)) + return true; + + return false; +} + bool Type::isEnumeralType() const { if (const TagType *TT = dyn_cast<TagType>(CanonicalType)) return TT->getDecl()->isEnum(); |