diff options
author | John McCall <rjmccall@apple.com> | 2011-09-09 05:25:32 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-09-09 05:25:32 +0000 |
commit | 1d9b3b25f7ac0d0195bba6b507a684fe5e7943ee (patch) | |
tree | 0545d4c18cceef895850efe81eac6aa3d054bea7 /lib/AST/Type.cpp | |
parent | 5e4c80b43fae03bc56b68fe08089e6cffe9ba6fc (diff) |
Give conversions of block pointers to ObjC pointers a different cast kind
than conversions of C pointers to ObjC pointers. In order to ensure that
we've caught every case, add asserts to CastExpr that strictly determine
which cast kind is used for which kind of bit cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139352 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r-- | lib/AST/Type.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp index 16aeb45162..ca58ec05ac 100644 --- a/lib/AST/Type.cpp +++ b/lib/AST/Type.cpp @@ -833,14 +833,16 @@ Type::ScalarTypeKind Type::getScalarTypeKind() const { const Type *T = CanonicalType.getTypePtr(); if (const BuiltinType *BT = dyn_cast<BuiltinType>(T)) { if (BT->getKind() == BuiltinType::Bool) return STK_Bool; - if (BT->getKind() == BuiltinType::NullPtr) return STK_Pointer; + if (BT->getKind() == BuiltinType::NullPtr) return STK_CPointer; if (BT->isInteger()) return STK_Integral; if (BT->isFloatingPoint()) return STK_Floating; llvm_unreachable("unknown scalar builtin type"); - } else if (isa<PointerType>(T) || - isa<BlockPointerType>(T) || - isa<ObjCObjectPointerType>(T)) { - return STK_Pointer; + } else if (isa<PointerType>(T)) { + return STK_CPointer; + } else if (isa<BlockPointerType>(T)) { + return STK_BlockPointer; + } else if (isa<ObjCObjectPointerType>(T)) { + return STK_ObjCObjectPointer; } else if (isa<MemberPointerType>(T)) { return STK_MemberPointer; } else if (isa<EnumType>(T)) { @@ -853,7 +855,6 @@ Type::ScalarTypeKind Type::getScalarTypeKind() const { } llvm_unreachable("unknown scalar type"); - return STK_Pointer; } /// \brief Determines whether the type is a C++ aggregate type or C |