diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 88610a85e94018..ec06b76e74ca37 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -2500,6 +2500,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. @@ -2574,6 +2577,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 diff --git a/clang/test/CodeGenObjC/direct-method.m b/clang/test/CodeGenObjC/direct-method.m index eb5a52eb11a23f..373bd22a84cddf 100644 --- a/clang/test/CodeGenObjC/direct-method.m +++ b/clang/test/CodeGenObjC/direct-method.m @@ -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]; +}