Debian Codegraph @

clang/test/Modules/decldef.m

raw
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;
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 {{not visible}}
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(void) {
34 B b; // Note: redundant error silenced
35 }
36
37 void testDef(void) {
38 [def defMethod];
39 }