Also synthesize _cmd and self for properties

Patch by: Pierre Habouzit

Differential Revision: https://reviews.llvm.org/D71226
This commit is contained in:
Pierre Habouzit 2019-12-09 14:27:57 -08:00 committed by Alex Lorenz
parent d5acc83a3a
commit 1646bb8664
2 changed files with 17 additions and 0 deletions

View File

@ -2498,6 +2498,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) {
// A user declared getter will be synthesize when @synthesize of
// the property with the same name is seen in the @implementation
GetterMethod->setPropertyAccessor(true);
GetterMethod->createImplicitParams(Context,
GetterMethod->getClassInterface());
property->setGetterMethodDecl(GetterMethod);
// Skip setter if property is read-only.
@ -2569,6 +2572,9 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property) {
// A user declared setter will be synthesize when @synthesize of
// the property with the same name is seen in the @implementation
SetterMethod->setPropertyAccessor(true);
SetterMethod->createImplicitParams(Context,
SetterMethod->getClassInterface());
property->setSetterMethodDecl(SetterMethod);
}
// Add any synthesized methods to the global pool. This allows us to

View File

@ -190,3 +190,14 @@ int useRoot(Root *r) {
// CHECK: %{{[^ ]*}} = call i32 bitcast {{.*}} @"\01-[Root intProperty2]"
return [r getInt] + [r intProperty] + [r intProperty2];
}
__attribute__((objc_root_class))
@interface RootDeclOnly
@property(direct, readonly) int intProperty;
@end
int useRootDeclOnly(RootDeclOnly *r) {
// CHECK-LABEL: define i32 @useRootDeclOnly
// CHECK: %{{[^ ]*}} = call i32 bitcast {{.*}} @"\01-[RootDeclOnly intProperty]"
return [r intProperty];
}