r186709 - [arcmt] After checking is successful disable auto-synthesize to avoid "@synthesize of 'weak' property is only

Argyrios Kyrtzidis akyrtzi at gmail.com
Fri Jul 19 11:57:15 PDT 2013


Author: akirtzidis
Date: Fri Jul 19 13:57:15 2013
New Revision: 186709

URL: http://llvm.org/viewvc/llvm-project?rev=186709&view=rev
Log:
[arcmt] After checking is successful disable auto-synthesize to avoid "@synthesize of 'weak' property is only
allowed in ARC" errors.

rdar://14461559

Added:
    cfe/trunk/test/ARCMT/checking-in-arc.m
Modified:
    cfe/trunk/lib/ARCMigrate/ARCMT.cpp

Modified: cfe/trunk/lib/ARCMigrate/ARCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/ARCMT.cpp?rev=186709&r1=186708&r2=186709&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/ARCMT.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/ARCMT.cpp Fri Jul 19 13:57:15 2013
@@ -324,6 +324,9 @@ bool arcmt::checkForManualIssues(Compile
   // If we are migrating code that gets the '-fobjc-arc' flag, make sure
   // to remove it so that we don't get errors from normal compilation.
   origCI.getLangOpts()->ObjCAutoRefCount = false;
+  // Disable auto-synthesize to avoid "@synthesize of 'weak' property is only
+  // allowed in ARC" errors.
+  origCI.getLangOpts()->ObjCDefaultSynthProperties = false;
 
   return capturedDiags.hasErrors() || testAct.hasReportedErrors();
 }

Added: cfe/trunk/test/ARCMT/checking-in-arc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking-in-arc.m?rev=186709&view=auto
==============================================================================
--- cfe/trunk/test/ARCMT/checking-in-arc.m (added)
+++ cfe/trunk/test/ARCMT/checking-in-arc.m Fri Jul 19 13:57:15 2013
@@ -0,0 +1,47 @@
+// RUN: %clang_cc1 -arcmt-check -fobjc-arc -fobjc-default-synthesize-properties -fobjc-runtime=macosx-10.8.0 -triple x86_64-apple-darwin12 -fblocks -Werror %s
+// DISABLE: mingw32
+
+#if __has_feature(objc_arc)
+#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
+#else
+#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
+#endif
+
+typedef const void * CFTypeRef;
+CFTypeRef CFBridgingRetain(id X);
+id CFBridgingRelease(CFTypeRef);
+
+typedef int BOOL;
+typedef unsigned NSUInteger;
+
+ at protocol NSObject
+- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
+ at end
+
+ at interface NSObject <NSObject> {}
+- (id)init;
+
++ (id)new;
++ (id)alloc;
+- (void)dealloc;
+
+- (void)finalize;
+
+- (id)copy;
+- (id)mutableCopy;
+ at end
+
+typedef const struct __CFString * CFStringRef;
+extern const CFStringRef kUTTypePlainText;
+extern const CFStringRef kUTTypeRTF;
+ at class NSString;
+
+ at interface Test : NSObject
+ at property (weak) NSString *weakProperty;
+ at end
+
+ at implementation Test
+ at end





More information about the cfe-commits mailing list