Debian Codegraph @

clang/test/Modules/suggest-include.cpp

raw
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 // [email protected]:2 {{here}}
7 // [email protected]:1 {{here}}
8 // [email protected]:1 {{here}}
9 // [email protected]:1 {{here}}
10 // [email protected]:1 {{here}}
11 // [email protected]:1 {{here}}
12 // [email protected]:1 {{here}}
13 // [email protected]:1 {{here}}
14
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 // If the declaration is in an include-guarded header, make sure we suggest
20 // including that rather than importing a module. In this case, there could
21 // be more than one module, and the module name we picked is almost certainly
22 // wrong.
23 (void)::textual4; // expected-error {{missing '#include "usetextual4.h"'; 'textual4' must be declared before it is used}}
24 (void)::textual5; // expected-error {{missing '#include "usetextual5.h"'; 'textual5' must be declared before it is used}}
25
26 // Don't suggest #including a private header.
27 // FIXME: We could suggest including "useprivate1.h" here, as it's the only
28 // public way to get at this declaration.
29 (void)::private1; // expected-error-re {{{{^}}declaration of 'private1'}}
30 // FIXME: Should we be suggesting an import at all here? Should declarations
31 // in private headers be visible when the surrounding module is imported?
32 (void)::private2; // expected-error-re {{{{^}}declaration of 'private2'}}
33 // Even if we suggest an include for private1, we should not do so here.
34 (void)::private3; // expected-error-re {{{{^}}declaration of 'private3'}}
35 }