aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Type.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-08 20:08:18 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-08 20:08:18 +0000
commitd1877953f06df6df9b2cd5fc04b49e80eec66019 (patch)
treeebf2aeca8dc7940c9b947ee27dd1102ba834ac66 /lib/AST/Type.cpp
parent6b5415196327fa8ef00f028ba175fafef1738ae1 (diff)
Fix a crash when overloading id with objc_object*.
Radar 8400356. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Type.cpp')
-rw-r--r--lib/AST/Type.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 8e6aa23618..114c9ac7df 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -470,6 +470,24 @@ bool Type::isIntegralOrEnumerationType() const {
return false;
}
+bool Type::isLegacyObjCIdType(ASTContext &Ctx) const {
+ if (const PointerType *PTTo = getAs<PointerType>()) {
+ QualType PointeeTy = PTTo->getPointeeType();
+ if (const RecordType *RTy = PointeeTy->getAs<RecordType>())
+ return RTy->getDecl()->getIdentifier() == &Ctx.Idents.get("objc_object");
+ }
+ return false;
+}
+
+bool Type::isLegacyObjCClassType(ASTContext &Ctx) const {
+ if (const PointerType *PTTo = getAs<PointerType>()) {
+ QualType PointeeTy = PTTo->getPointeeType();
+ if (const RecordType *RTy = PointeeTy->getAs<RecordType>())
+ return RTy->getDecl()->getIdentifier() == &Ctx.Idents.get("objc_class");
+ }
+ return false;
+}
+
bool Type::isEnumeralType() const {
if (const TagType *TT = dyn_cast<TagType>(CanonicalType))
return TT->getDecl()->isEnum();