Skip to content

Commit 73634fe

Browse files
authored
Merge pull request #439 from apple/eng/PR-57764169-direct-method-crash-20191106
Also synthesize _cmd and self for properties
2 parents 7710e21 + c48855f commit 73634fe

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

clang/lib/Sema/SemaObjCProperty.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,6 +2500,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) {
25002500
// A user declared getter will be synthesize when @synthesize of
25012501
// the property with the same name is seen in the @implementation
25022502
GetterMethod->setPropertyAccessor(true);
2503+
2504+
GetterMethod->createImplicitParams(Context,
2505+
GetterMethod->getClassInterface());
25032506
property->setGetterMethodDecl(GetterMethod);
25042507

25052508
// Skip setter if property is read-only.
@@ -2574,6 +2577,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) {
25742577
// A user declared setter will be synthesize when @synthesize of
25752578
// the property with the same name is seen in the @implementation
25762579
SetterMethod->setPropertyAccessor(true);
2580+
2581+
SetterMethod->createImplicitParams(Context,
2582+
SetterMethod->getClassInterface());
25772583
property->setSetterMethodDecl(SetterMethod);
25782584
}
25792585
// Add any synthesized methods to the global pool. This allows us to

clang/test/CodeGenObjC/direct-method.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,14 @@ int useRoot(Root *r) {
190190
// CHECK: %{{[^ ]*}} = call i32 bitcast {{.*}} @"\01-[Root intProperty2]"
191191
return [r getInt] + [r intProperty] + [r intProperty2];
192192
}
193+
194+
__attribute__((objc_root_class))
195+
@interface RootDeclOnly
196+
@property(direct, readonly) int intProperty;
197+
@end
198+
199+
int useRootDeclOnly(RootDeclOnly *r) {
200+
// CHECK-LABEL: define i32 @useRootDeclOnly
201+
// CHECK: %{{[^ ]*}} = call i32 bitcast {{.*}} @"\01-[RootDeclOnly intProperty]"
202+
return [r intProperty];
203+
}

0 commit comments

Comments
 (0)