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 //===----------------------------------------------------------------------===// 20 #elif !defined(HEADER2) 21 #define HEADER2 22 #if !defined(HEADER1) 23 #error Header inclusion order messed up 24 #endif 25 26 //===----------------------------------------------------------------------===// 27 // Dependent header 28 29 @interface MyClass : NSObject 30 +(void)meth; 31 @end 32 33 @interface NSObject(ObjExt) 34 -(void)extMeth; 35 @end 36 37 //===----------------------------------------------------------------------===// 38 #else 39 //===----------------------------------------------------------------------===// 40 41 @implementation MyClass 42 +(void)meth {} 43 -(void)finalize { 44 [super finalize]; 45 } 46 @end 47 48 void test(NSObject *o) { 49 [o extMeth]; 50 } 51 52 //===----------------------------------------------------------------------===// 53 #endif 54