objective-c: fix a sema and IRGen crash when property
getter result type is safe but does not match with property
type resulting in spurious warning followed by crash in
IRGen. // rdar://11515196
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157641 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 88de7d3..fb49e9f 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -1114,9 +1114,9 @@
isa<ObjCObjectPointerType>(GetterType))
compat =
Context.canAssignObjCInterfaces(
- PropertyIvarType->getAs<ObjCObjectPointerType>(),
- GetterType->getAs<ObjCObjectPointerType>());
- else if (CheckAssignmentConstraints(Loc, PropertyIvarType, GetterType)
+ GetterType->getAs<ObjCObjectPointerType>(),
+ PropertyIvarType->getAs<ObjCObjectPointerType>());
+ else if (CheckAssignmentConstraints(Loc, GetterType, PropertyIvarType)
!= Compatible) {
Diag(Loc, diag::error_property_accessor_type)
<< property->getDeclName() << PropertyIvarType