• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 {{here}}
6
7@class Def;
8Def *def;
9
10@import decldef;
11#ifdef USE_EARLY
12A *a1; // expected-error{{declaration of 'A' must be imported from module 'decldef.Def' before it is required}}
13#endif
14B *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 {{not visible}}
20#endif
21@import decldef.Decl;
22
23A *a2;
24struct B *b;
25
26void 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
33void testB() {
34  B b; // Note: redundant error silenced
35}
36
37void testDef() {
38  [def defMethod];
39}
40