This fixes a crash when setting a property of struct type in -dealloc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@262659
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!ReceiverVal.isValid())
return nullptr;
- // Is the first argument nil?
if (M.getNumArgs() == 0)
return nullptr;
+
+ if (!M.getArgExpr(0)->getType()->isObjCRetainableType())
+ return nullptr;
+
+ // Is the first argument nil?
SVal Arg = M.getArgSVal(0);
ProgramStateRef notNilState, nilState;
std::tie(notNilState, nilState) =
@end
#endif
+struct SomeStruct {
+ int f;
+};
+@interface ZeroOutStructWithSetter : NSObject
+ @property(assign) struct SomeStruct s;
+@end
+
+@implementation ZeroOutStructWithSetter
+- (void)dealloc {
+ struct SomeStruct zeroedS;
+ zeroedS.f = 0;
+
+ self.s = zeroedS;
+#if NON_ARC
+ [super dealloc];
+#endif
+}
+@end
+
#if NON_ARC
@interface ReleaseIvarInArray : NSObject {
NSObject *_array[3];