Browse Source

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@215259 91177308-0d34-0410-b5e6-96231b3b80d8
Bob Wilson 11 years ago
parent
commit
3189dba58d
2 changed files with 4 additions and 4 deletions
  1. 2 0
      lib/Frontend/InitPreprocessor.cpp
  2. 2 4
      test/SemaObjC/iboutlet.m

+ 2 - 0
lib/Frontend/InitPreprocessor.cpp

@@ -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)

+ 2 - 4
test/SemaObjC/iboutlet.m

@@ -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}}