Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions clang/lib/Sema/SemaObjCProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions clang/test/CodeGenObjC/direct-method.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}