This flag specifies that the normal visibility rules should be used even for local submodules (submodules of the currently-being-built module). Thus names will only be visible if a header / module that declares them has actually been included / imported, and not merely because a submodule that happened to be built earlier declared those names. This also removes the need to modularize bottom-up: textually-included headers will be included into every submodule that includes them, since their include guards will not leak between modules. So far, this only governs visibility of macros, not of declarations, so is not ready for real use yet. llvm-svn: 236350
40 lines
2.8 KiB
C++
40 lines
2.8 KiB
C++
// RUN: rm -rf %t
|
|
// RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
//
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DC1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DC1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD2 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DD2 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DF1 -I%S/Inputs/macro-reexport %s -fmodules-cache-path=%t -verify
|
|
// RUN: %clang_cc1 -fmodules-local-submodule-visibility -fsyntax-only -DF1 -I%S/Inputs/macro-reexport -fmodules %s -fmodules-cache-path=%t -verify
|
|
|
|
#if defined(F1)
|
|
#include "f1.h"
|
|
void f() { return assert(true); } // expected-error {{undeclared identifier 'd'}}
|
|
#include "e2.h" // undefines d1's macro
|
|
void g() { return assert(true); } // expected-error {{undeclared identifier 'assert'}}
|
|
#elif defined(D1)
|
|
#include "e1.h" // undefines c1's macro but not d1's macro
|
|
#include "d1.h"
|
|
void f() { return assert(true); } // expected-error {{undeclared identifier 'd'}}
|
|
#include "e2.h" // undefines d1's macro
|
|
void g() { return assert(true); } // expected-error {{undeclared identifier 'assert'}}
|
|
#elif defined(D2)
|
|
#include "d2.h"
|
|
void f() { return assert(true); } // expected-error {{undeclared identifier 'b'}}
|
|
#else
|
|
// e2 undefines d1's macro, which overrides c1's macro.
|
|
#include "e2.h"
|
|
#include "c1.h"
|
|
void f() { return assert(true); } // expected-error {{undeclared identifier 'assert'}}
|
|
#endif
|