mirror of https://github.com/microsoft/clang.git
When we leave a module header, make that header visible in its
includer's context, even if its overall module is unavailable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342096 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8b335cfaae
commit
3a8c8e45f9
|
@ -577,10 +577,6 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
|
|||
};
|
||||
|
||||
std::function<void(Visiting)> VisitModule = [&](Visiting V) {
|
||||
// Modules that aren't available cannot be made visible.
|
||||
if (!V.M->isAvailable())
|
||||
return;
|
||||
|
||||
// Nothing to do for a module that's already visible.
|
||||
unsigned ID = V.M->getVisibilityID();
|
||||
if (ImportLocs.size() <= ID)
|
||||
|
@ -594,8 +590,11 @@ void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc,
|
|||
// Make any exported modules visible.
|
||||
SmallVector<Module *, 16> Exports;
|
||||
V.M->getExportedModules(Exports);
|
||||
for (Module *E : Exports)
|
||||
VisitModule({E, &V});
|
||||
for (Module *E : Exports) {
|
||||
// Don't recurse to unavailable submodules.
|
||||
if (E->isAvailable())
|
||||
VisitModule({E, &V});
|
||||
}
|
||||
|
||||
for (auto &C : V.M->Conflicts) {
|
||||
if (isVisible(C.Other)) {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef A_H
|
||||
#define A_H
|
||||
#include "x.h"
|
||||
#endif
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef B_H
|
||||
#define B_H
|
||||
#include "a.h"
|
||||
|
||||
#ifndef A_H
|
||||
#error where is a?
|
||||
#endif
|
||||
|
||||
#ifndef X_H
|
||||
#error where is x?
|
||||
#endif
|
||||
X f();
|
||||
#endif
|
|
@ -0,0 +1,9 @@
|
|||
module M {
|
||||
module a { header "a.h" export * }
|
||||
module b { header "b.h" export * }
|
||||
module doesnotexist { header "doesnotexist.h" }
|
||||
}
|
||||
module X {
|
||||
header "x.h"
|
||||
export *
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef X_H
|
||||
#define X_H
|
||||
struct X {};
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
// RUN: %clang_cc1 -fmodules -I%S/Inputs/unavailable-local-visibility -fmodule-name=X -emit-module -x c++-module-map %S/Inputs/unavailable-local-visibility/module.modulemap -o %t/x.pcm
|
||||
// RUN: %clang_cc1 -fmodules -I%S/Inputs/unavailable-local-visibility -fmodule-name=M -fmodule-map-file=%S/Inputs/unavailable-local-visibility/module.modulemap -fmodules-local-submodule-visibility -fmodule-file=%t/x.pcm -fsyntax-only -x c++-header %S/Inputs/unavailable-local-visibility/b.h
|
Loading…
Reference in New Issue