@@ -1736,10 +1736,8 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
1736
1736
auto &diagClient = static_cast <ClangDiagnosticConsumer &>(rawDiagClient);
1737
1737
1738
1738
auto loadModule = [&](clang::ModuleIdPath path,
1739
- bool makeVisible) -> clang::ModuleLoadResult {
1740
- clang::Module::NameVisibilityKind visibility =
1741
- makeVisible ? clang::Module::AllVisible : clang::Module::Hidden;
1742
-
1739
+ clang::Module::NameVisibilityKind visibility)
1740
+ -> clang::ModuleLoadResult {
1743
1741
auto importRAII =
1744
1742
diagClient.handleImport (clangPath.front ().first , importLoc);
1745
1743
@@ -1765,14 +1763,14 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
1765
1763
clangFEOpts.IndexStorePath = preservedIndexStorePathOption;
1766
1764
}
1767
1765
1768
- if (result && makeVisible)
1766
+ if (result && (visibility == clang::Module::AllVisible)) {
1769
1767
getClangPreprocessor ().makeModuleVisible (result, clangImportLoc);
1768
+ }
1770
1769
return result;
1771
1770
};
1772
1771
1773
1772
// Now load the top-level module, so that we can check if the submodule
1774
1773
// exists without triggering a fatal error.
1775
- clangModule = loadModule (clangPath.front (), false );
1776
1774
if (!clangModule)
1777
1775
return nullptr ;
1778
1776
@@ -1787,7 +1785,8 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
1787
1785
// put the Clang AST in a fatal error state if it /doesn't/ exist.
1788
1786
if (!submodule && component.Item .str () == " Private" &&
1789
1787
(&component) == (&path[1 ])) {
1790
- submodule = loadModule (llvm::makeArrayRef (clangPath).slice (0 , 2 ), false );
1788
+ submodule = loadModule (llvm::makeArrayRef (clangPath).slice (0 , 2 ),
1789
+ clang::Module::Hidden);
1791
1790
}
1792
1791
1793
1792
if (!submodule) {
@@ -1797,7 +1796,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
1797
1796
}
1798
1797
1799
1798
// Finally, load the submodule and make it visible.
1800
- clangModule = loadModule (clangPath, true );
1799
+ clangModule = loadModule (clangPath, clang::Module::AllVisible );
1801
1800
if (!clangModule)
1802
1801
return nullptr ;
1803
1802
0 commit comments