Skip to content

Commit 565478c

Browse files
committed
[NFC] Drop a boolean in favor of clang::Module::NameVisibilityKind
The intent of the enum class is more immediately readable than a single bit that we're reconstituting into the enum class anyways.
1 parent c6ea30c commit 565478c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,10 +1736,8 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
17361736
auto &diagClient = static_cast<ClangDiagnosticConsumer &>(rawDiagClient);
17371737

17381738
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 {
17431741
auto importRAII =
17441742
diagClient.handleImport(clangPath.front().first, importLoc);
17451743

@@ -1765,14 +1763,14 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
17651763
clangFEOpts.IndexStorePath = preservedIndexStorePathOption;
17661764
}
17671765

1768-
if (result && makeVisible)
1766+
if (result && (visibility == clang::Module::AllVisible)) {
17691767
getClangPreprocessor().makeModuleVisible(result, clangImportLoc);
1768+
}
17701769
return result;
17711770
};
17721771

17731772
// Now load the top-level module, so that we can check if the submodule
17741773
// exists without triggering a fatal error.
1775-
clangModule = loadModule(clangPath.front(), false);
17761774
if (!clangModule)
17771775
return nullptr;
17781776

@@ -1787,7 +1785,8 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
17871785
// put the Clang AST in a fatal error state if it /doesn't/ exist.
17881786
if (!submodule && component.Item.str() == "Private" &&
17891787
(&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);
17911790
}
17921791

17931792
if (!submodule) {
@@ -1797,7 +1796,7 @@ ModuleDecl *ClangImporter::Implementation::loadModuleClang(
17971796
}
17981797

17991798
// Finally, load the submodule and make it visible.
1800-
clangModule = loadModule(clangPath, true);
1799+
clangModule = loadModule(clangPath, clang::Module::AllVisible);
18011800
if (!clangModule)
18021801
return nullptr;
18031802

0 commit comments

Comments
 (0)