Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Richard Smith | d67679d | 2013-08-20 20:35:18 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify |
| 4 | |
Richard Smith | d67679d | 2013-08-20 20:35:18 +0000 | [diff] [blame] | 5 | // expected-note@Inputs/def.h:5 {{previous}} |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 6 | |
| 7 | @class Def; |
| 8 | Def *def; |
| 9 | |
| 10 | @import decldef; |
Richard Smith | d67679d | 2013-08-20 20:35:18 +0000 | [diff] [blame] | 11 | #ifdef USE_EARLY |
| 12 | A *a1; // expected-error{{declaration of 'A' must be imported from module 'decldef.Def' before it is required}} |
| 13 | #endif |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 14 | B *b1; // expected-error{{must use 'struct' tag to refer to type 'B'}} |
| 15 | @import decldef.Decl; |
| 16 | |
| 17 | A *a2; |
| 18 | struct B *b; |
| 19 | |
| 20 | void testA(A *a) { |
Richard Smith | d67679d | 2013-08-20 20:35:18 +0000 | [diff] [blame] | 21 | a->ivar = 17; |
| 22 | #ifndef USE_EARLY |
| 23 | // expected-error@-2{{definition of 'A' must be imported from module 'decldef.Def' before it is required}} |
| 24 | #endif |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | void testB() { |
| 28 | B b; // Note: redundant error silenced |
| 29 | } |
| 30 | |
| 31 | void testDef() { |
| 32 | [def defMethod]; |
| 33 | } |