aboutsummaryrefslogtreecommitdiff
path: root/test/Rewriter
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-05-09 16:15:46 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-05-09 16:15:46 +0000
commit4c4cc16dbb4ab44909ea3cbb43609ef5ea19b9d2 (patch)
tree4fc64f2fd5a61d5c4d4ffb2cdb048ce9b8db1747 /test/Rewriter
parente15db6f0d226a3bc88d244512d1004c7c1c07391 (diff)
Re-add test for // rdar://11374235
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156477 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Rewriter')
-rw-r--r--test/Rewriter/rewrite-modern-default-property-synthesis.mm85
1 files changed, 85 insertions, 0 deletions
diff --git a/test/Rewriter/rewrite-modern-default-property-synthesis.mm b/test/Rewriter/rewrite-modern-default-property-synthesis.mm
new file mode 100644
index 0000000000..41cc005b4a
--- /dev/null
+++ b/test/Rewriter/rewrite-modern-default-property-synthesis.mm
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -x objective-c++ -fms-extensions -fobjc-default-synthesize-properties -rewrite-objc %t.mm -o %t-rw.cpp
+// RUN: FileCheck --input-file=%t-rw.cpp %s
+// RUN: %clang_cc1 -fsyntax-only -Werror -DSEL="void *" -Did="struct objc_object *" -Wno-attributes -Wno-address-of-temporary -U__declspec -D"__declspec(X)=" %t-rw.cpp
+// rdar://11374235
+
+extern "C" void *sel_registerName(const char *);
+
+@interface NSObject
+- (void) release;
+- (id) retain;
+@end
+@class NSString;
+
+@interface SynthItAll : NSObject
+@property int howMany;
+@property (retain) NSString* what;
+@end
+
+@implementation SynthItAll
+@end
+
+
+@interface SynthSetter : NSObject
+@property (nonatomic) int howMany;
+@property (nonatomic, retain) NSString* what;
+@end
+
+@implementation SynthSetter
+
+- (int) howMany {
+ return _howMany;
+}
+// - (void) setHowMany: (int) value
+
+- (NSString*) what {
+ return _what;
+}
+// - (void) setWhat: (NSString*) value
+@end
+
+
+@interface SynthGetter : NSObject
+@property (nonatomic) int howMany;
+@property (nonatomic, retain) NSString* what;
+@end
+
+@implementation SynthGetter
+// - (int) howMany
+- (void) setHowMany: (int) value {
+ _howMany = value;
+}
+
+// - (NSString*) what
+- (void) setWhat: (NSString*) value {
+ if (_what != value) {
+ [_what release];
+ _what = [value retain];
+ }
+}
+@end
+
+typedef struct {
+ int x:1;
+ int y:1;
+} TBAR;
+
+@interface NONAME
+{
+ TBAR _bar;
+}
+@property TBAR bad;
+@end
+
+@implementation NONAME
+@end
+
+// CHECK: static int _I_SynthGetter_howMany
+// CHECK: return (*(int *)((char *)self + OBJC_IVAR_$_SynthGetter$_howMany));
+// CHECK: static NSString * _I_SynthGetter_what
+// CHECK: return (*(NSString **)((char *)self + OBJC_IVAR_$_SynthGetter$_what));
+// CHECK: static TBAR _I_NONAME_bad
+// CHECK: return (*(TBAR *)((char *)self + OBJC_IVAR_$_NONAME$_bad));
+// CHECK: static void _I_NONAME_setBad_
+// CHECK: (*(TBAR *)((char *)self + OBJC_IVAR_$_NONAME$_bad)) = bad;