[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / Modules / suggest-include.cpp
blob1e53ef05d5f83029a9f181863b00e7c4400a24b1
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs/suggest-include %s -verify
4 #include "empty.h" // import the module file
6 // expected-note@usetextual1.h:2 {{here}}
7 // expected-note@textual2.h:1 {{here}}
8 // expected-note@textual3.h:1 {{here}}
9 // expected-note@textual4.h:1 {{here}}
10 // expected-note@textual5.h:1 {{here}}
11 // expected-note@private1.h:1 {{here}}
12 // expected-note@private2.h:1 {{here}}
13 // expected-note@private3.h:1 {{here}}
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}}
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'}}