[cfe-commits] r156477 - /cfe/trunk/test/Rewriter/rewrite-modern-default-property-synthesis.mm
Fariborz Jahanian
fjahanian at apple.com
Wed May 9 09:15:46 PDT 2012
Author: fjahanian
Date: Wed May 9 11:15:46 2012
New Revision: 156477
URL: http://llvm.org/viewvc/llvm-project?rev=156477&view=rev
Log:
Re-add test for // rdar://11374235
Added:
cfe/trunk/test/Rewriter/rewrite-modern-default-property-synthesis.mm
Added: cfe/trunk/test/Rewriter/rewrite-modern-default-property-synthesis.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-modern-default-property-synthesis.mm?rev=156477&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-modern-default-property-synthesis.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-modern-default-property-synthesis.mm Wed May 9 11:15:46 2012
@@ -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 *);
+
+ at interface NSObject
+- (void) release;
+- (id) retain;
+ at end
+ at class NSString;
+
+ at interface SynthItAll : NSObject
+ at property int howMany;
+ at property (retain) NSString* what;
+ at end
+
+ at implementation SynthItAll
+ at end
+
+
+ at interface SynthSetter : NSObject
+ at property (nonatomic) int howMany;
+ at property (nonatomic, retain) NSString* what;
+ at end
+
+ at implementation SynthSetter
+
+- (int) howMany {
+ return _howMany;
+}
+// - (void) setHowMany: (int) value
+
+- (NSString*) what {
+ return _what;
+}
+// - (void) setWhat: (NSString*) value
+ at end
+
+
+ at interface SynthGetter : NSObject
+ at property (nonatomic) int howMany;
+ at property (nonatomic, retain) NSString* what;
+ at end
+
+ at implementation SynthGetter
+// - (int) howMany
+- (void) setHowMany: (int) value {
+ _howMany = value;
+}
+
+// - (NSString*) what
+- (void) setWhat: (NSString*) value {
+ if (_what != value) {
+ [_what release];
+ _what = [value retain];
+ }
+}
+ at end
+
+typedef struct {
+ int x:1;
+ int y:1;
+} TBAR;
+
+ at interface NONAME
+{
+ TBAR _bar;
+}
+ at property TBAR bad;
+ at end
+
+ at implementation NONAME
+ at 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;
More information about the cfe-commits
mailing list