Home | History | Annotate | Download | only in PCH
      1 // Without PCH
      2 // RUN: %clang_cc1 -fsyntax-only -verify -include %s -include %s %s
      3 
      4 // With PCH
      5 // RUN: %clang_cc1 -fsyntax-only -verify %s -chain-include %s -chain-include %s
      6 
      7 // expected-no-diagnostics
      8 
      9 #ifndef HEADER1
     10 #define HEADER1
     11 //===----------------------------------------------------------------------===//
     12 // Primary header
     13 
     14 @interface NSObject
     15 - (id)init;
     16 - (void)finalize;
     17 @end
     18 
     19 @interface NSObject (Properties)
     20 @property (readonly,nonatomic) int intProp;
     21 @end
     22 
     23 //===----------------------------------------------------------------------===//
     24 #elif !defined(HEADER2)
     25 #define HEADER2
     26 #if !defined(HEADER1)
     27 #error Header inclusion order messed up
     28 #endif
     29 
     30 //===----------------------------------------------------------------------===//
     31 // Dependent header
     32 
     33 @interface MyClass : NSObject
     34 +(void)meth;
     35 @end
     36 
     37 @interface NSObject(ObjExt)
     38 -(void)extMeth;
     39 @end
     40 
     41 @interface NSObject ()
     42 @property (readwrite,nonatomic) int intProp;
     43 @end
     44 
     45 @class NSObject;
     46 
     47 //===----------------------------------------------------------------------===//
     48 #else
     49 //===----------------------------------------------------------------------===//
     50 
     51 @implementation MyClass
     52 +(void)meth {}
     53 -(void)finalize {
     54   [super finalize];
     55 }
     56 @end
     57 
     58 void test(NSObject *o) {
     59   [o extMeth];
     60 
     61   // Make sure the property is treated as read-write.
     62   o.intProp = 17;
     63 }
     64 
     65 //===----------------------------------------------------------------------===//
     66 #endif
     67