1 | // RUN: rm -rf %t |
2 | // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY |
3 | // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify |
4 | |
5 | // expected-note@Inputs/def.h:5 {{previous}} |
6 | |
7 | @class Def; |
8 | Def *def; |
9 | |
10 | @import decldef; |
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 |
14 | B *b1; |
15 | #ifdef USE_EARLY |
16 | // expected-error@-2{{must use 'struct' tag to refer to type 'B'}} |
17 | #else |
18 | // expected-error@-4{{declaration of 'B' must be imported from module 'decldef.Decl' before it is required}} |
19 | // expected-note@Inputs/decl.h:2 {{previous}} |
20 | #endif |
21 | @import decldef.Decl; |
22 | |
23 | A *a2; |
24 | struct B *b; |
25 | |
26 | void testA(A *a) { |
27 | a->ivar = 17; |
28 | #ifndef USE_EARLY |
29 | // expected-error@-2{{definition of 'A' must be imported from module 'decldef.Def' before it is required}} |
30 | #endif |
31 | } |
32 | |
33 | void testB() { |
34 | B b; // Note: redundant error silenced |
35 | } |
36 | |
37 | void testDef() { |
38 | [def defMethod]; |
39 | } |
40 | |