llvm-capstone/clang/test/CodeGenObjC/instance-method-metadata.m
Adrian Prantl 2073dd2da7 Redeclare Objective-C property accessors inside the ObjCImplDecl in which they are synthesized.
This patch is motivated by (and factored out from)
https://reviews.llvm.org/D66121 which is a debug info bugfix. Starting
with DWARF 5 all Objective-C methods are nested inside their
containing type, and that patch implements this for synthesized
Objective-C properties.

1. SemaObjCProperty populates a list of synthesized accessors that may
   need to inserted into an ObjCImplDecl.

2. SemaDeclObjC::ActOnEnd inserts forward-declarations for all
   accessors for which no override was provided into their
   ObjCImplDecl. This patch does *not* synthesize AST function
   *bodies*. Moving that code from the static analyzer into Sema may
   be a good idea though.

3. Places that expect all methods to have bodies have been updated.

I did not update the static analyzer's inliner for synthesized
properties to point back to the property declaration (see
test/Analysis/Inputs/expected-plists/nullability-notes.m.plist), which
I believed to be more bug than a feature.

Differential Revision: https://reviews.llvm.org/D68108

rdar://problem/53782400
2019-11-08 08:23:22 -08:00

35 lines
843 B
Objective-C

// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S %s -o - | FileCheck %s
// rdar://9072317
/** The problem looks like clang getting confused when a single translation unit
contains a protocol with a property and two classes that implement that protocol
and synthesize the property.
*/
@protocol Proto
@property (assign) id prop;
@end
@interface NSObject @end
@interface Foo : NSObject <Proto> { int x; } @end
@interface Bar : NSObject <Proto> @end
@implementation Foo
@synthesize prop;
@end
@implementation Bar
@synthesize prop;
@end
// CHECK: _OBJC_$_INSTANCE_METHODS_Bar:
// CHECK-NEXT: .long 24
// CHECK-NEXT: .long 2
// CHECK-NEXT: .quad L_OBJC_METH_VAR_NAME_
// CHECK-NEXT: .quad L_OBJC_METH_VAR_TYPE_
// CHECK-NEXT: .quad "-[Bar prop]"