r215259 - Predefine IB_DESIGNABLE and IBInspectable macros. <rdar://problem/17441860>

Bob Wilson bob.wilson at apple.com
Fri Aug 8 16:46:25 PDT 2014


Author: bwilson
Date: Fri Aug  8 18:46:25 2014
New Revision: 215259

URL: http://llvm.org/viewvc/llvm-project?rev=215259&view=rev
Log:
Predefine IB_DESIGNABLE and IBInspectable macros. <rdar://problem/17441860>

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.

Modified:
    cfe/trunk/lib/Frontend/InitPreprocessor.cpp
    cfe/trunk/test/SemaObjC/iboutlet.m

Modified: cfe/trunk/lib/Frontend/InitPreprocessor.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/InitPreprocessor.cpp?rev=215259&r1=215258&r2=215259&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/InitPreprocessor.cpp (original)
+++ cfe/trunk/lib/Frontend/InitPreprocessor.cpp Fri Aug  8 18:46:25 2014
@@ -530,6 +530,8 @@ static void InitializePredefinedMacros(c
     Builder.defineMacro("IBOutletCollection(ClassName)",
                         "__attribute__((iboutletcollection(ClassName)))");
     Builder.defineMacro("IBAction", "void)__attribute__((ibaction)");
+    Builder.defineMacro("IBInspectable", "");
+    Builder.defineMacro("IB_DESIGNABLE", "");
   }
 
   if (LangOpts.CPlusPlus)

Modified: cfe/trunk/test/SemaObjC/iboutlet.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/iboutlet.m?rev=215259&r1=215258&r2=215259&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/iboutlet.m (original)
+++ cfe/trunk/test/SemaObjC/iboutlet.m Fri Aug  8 18:46:25 2014
@@ -6,12 +6,10 @@
 
 @class NSView;
 
-#define IBOutlet __attribute__((iboutlet))
-
- at 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}}
 
- at 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}}
 





More information about the cfe-commits mailing list