summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Habouzit <phabouzit@apple.com>2019-12-09 14:27:57 -0800
committerAlex Lorenz <arphaman@gmail.com>2019-12-09 14:30:01 -0800
commit1646bb86643326db6e220291d5c71c8d616f66fb (patch)
treedf65e077974e2d9a067055888cab8e3dbd8d3d06
parentd5acc83a3ac3db85ca30b9e73b1bdb112f313d1b (diff)
downloadbcm5719-llvm-1646bb86643326db6e220291d5c71c8d616f66fb.tar.gz
bcm5719-llvm-1646bb86643326db6e220291d5c71c8d616f66fb.zip
Also synthesize _cmd and self for properties
Patch by: Pierre Habouzit Differential Revision: https://reviews.llvm.org/D71226
-rw-r--r--clang/lib/Sema/SemaObjCProperty.cpp6
-rw-r--r--clang/test/CodeGenObjC/direct-method.m11
2 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 2d91ea1f5fd..f6717f4cbe5 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -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
diff --git a/clang/test/CodeGenObjC/direct-method.m b/clang/test/CodeGenObjC/direct-method.m
index eb5a52eb11a..373bd22a84c 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];
+}
OpenPOWER on IntegriCloud