1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs/suggest-include %s -verify
3
4 #include "empty.h" // import the module file
5
6 // expected-note@usetextual1.h:2 {{previous}}
7 // expected-note@textual2.h:1 {{previous}}
8 // expected-note@textual3.h:1 {{previous}}
9 // expected-note@textual4.h:1 {{previous}}
10 // expected-note@textual5.h:1 {{previous}}
11 // expected-note@private1.h:1 {{previous}}
12 // expected-note@private2.h:1 {{previous}}
13 // expected-note@private3.h:1 {{previous}}
14
f()15 void f() {
16 (void)::usetextual1; // expected-error {{missing '#include "usetextual1.h"'}}
17 (void)::usetextual2; // expected-error {{missing '#include "usetextual2.h"'}}
18 (void)::textual3; // expected-error-re {{{{^}}missing '#include "usetextual3.h"'}}
19 // Don't suggest a #include that includes the entity via a path that leaves
20 // the module. In that case we can't be sure that we've picked the right header.
21 (void)::textual4; // expected-error-re {{{{^}}declaration of 'textual4'}}
22 (void)::textual5; // expected-error-re {{{{^}}declaration of 'textual5'}}
23
24 // Don't suggest #including a private header.
25 // FIXME: We could suggest including "useprivate1.h" here, as it's the only
26 // public way to get at this declaration.
27 (void)::private1; // expected-error-re {{{{^}}declaration of 'private1'}}
28 // FIXME: Should we be suggesting an import at all here? Should declarations
29 // in private headers be visible when the surrounding module is imported?
30 (void)::private2; // expected-error-re {{{{^}}declaration of 'private2'}}
31 // Even if we suggest an include for private1, we should not do so here.
32 (void)::private3; // expected-error-re {{{{^}}declaration of 'private3'}}
33 }
34