]> granicus.if.org Git - clang/commitdiff
Predefine IB_DESIGNABLE and IBInspectable macros. <rdar://problem/17441860>
authorBob Wilson <bob.wilson@apple.com>
Fri, 8 Aug 2014 23:46:25 +0000 (23:46 +0000)
committerBob Wilson <bob.wilson@apple.com>
Fri, 8 Aug 2014 23:46:25 +0000 (23:46 +0000)
These macros are used as markers for Interface Builder and need to be defined
to empty strings since they have no impact on the code.

Patch by Ted Kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215259 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/InitPreprocessor.cpp
test/SemaObjC/iboutlet.m

index 7a9d09a5e7ac513532f810d5404510029bcf2bc0..32794f921236d567e4949572cfe4d782acc75b56 100644 (file)
@@ -530,6 +530,8 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
     Builder.defineMacro("IBOutletCollection(ClassName)",
                         "__attribute__((iboutletcollection(ClassName)))");
     Builder.defineMacro("IBAction", "void)__attribute__((ibaction)");
+    Builder.defineMacro("IBInspectable", "");
+    Builder.defineMacro("IB_DESIGNABLE", "");
   }
 
   if (LangOpts.CPlusPlus)
index 63eac9af8a5204403911bd5b7a7a979d7fc37ef5..7d656a51684a18aee65c2057f26af7a6a0cc7465 100644 (file)
@@ -6,12 +6,10 @@
 
 @class NSView;
 
-#define IBOutlet __attribute__((iboutlet))
-
-@interface I
+IB_DESIGNABLE @interface I
 @property (getter = MyGetter, readonly, assign) IBOutlet NSView *myView; // expected-warning {{readonly IBOutlet property 'myView' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
 
-@property (readonly) IBOutlet NSView *myView1; // expected-warning {{readonly IBOutlet property 'myView1' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
+IBInspectable @property (readonly) IBOutlet NSView *myView1; // expected-warning {{readonly IBOutlet property 'myView1' when auto-synthesized may not work correctly with 'nib' loader}} expected-note {{property should be changed to be readwrite}}
 
 @property (getter = MyGetter, READONLY) IBOutlet NSView *myView2; // expected-warning {{readonly IBOutlet property 'myView2' when auto-synthesized may not work correctly with 'nib' loader}}