brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 1e53ef0 Raw
36 lines · cpp
1// RUN: rm -rf %t2// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs/suggest-include %s -verify3 4#include "empty.h" // import the module file5 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}}14 15void 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 suggest20  // including that rather than importing a module. In this case, there could21  // be more than one module, and the module name we picked is almost certainly22  // 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 only28  // 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 declarations31  // 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}36