Skip to content

Commit c60fea3

Browse files
committed
Sema: Use clearer param name in getPublicModuleName
Use onlyIfImported instead of mustBeVisible.
1 parent 0be1dcc commit c60fea3

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

include/swift/AST/Module.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -511,11 +511,11 @@ class ModuleDecl
511511
/// This always returns a valid name as it defaults to the module name if
512512
/// no public module name is set.
513513
///
514-
/// If `mustBeVisible`, return the normal module name when the module
514+
/// If `onlyIfImported`, return the normal module name when the module
515515
/// corresponding to the public module name isn't imported. Users working
516516
/// in between both modules will then see the normal module name,
517517
/// this may be more useful for diagnostics at that level.
518-
Identifier getPublicModuleName(bool mustBeVisible) const;
518+
Identifier getPublicModuleName(bool onlyIfImported) const;
519519

520520
void setPublicModuleName(Identifier name) {
521521
PublicModuleName = name;

lib/AST/DiagnosticEngine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ static void formatDiagnosticArgument(StringRef Modifier,
800800
DeclName name;
801801
if (includeName) {
802802
if (auto MD = dyn_cast<ModuleDecl>(D))
803-
name = MD->getPublicModuleName(/*mustBeVisible=*/true);
803+
name = MD->getPublicModuleName(/*onlyIfImported=*/true);
804804
else if (auto VD = dyn_cast<ValueDecl>(D))
805805
name = VD->getName();
806806
else if (auto PGD = dyn_cast<PrecedenceGroupDecl>(D))
@@ -1374,7 +1374,7 @@ DiagnosticEngine::diagnosticInfoForDiagnostic(const Diagnostic &diagnostic) {
13741374
SmallVector<StringRef, 4> nameComponents;
13751375
while (dc) {
13761376
auto publicName = cast<ModuleDecl>(dc)->
1377-
getPublicModuleName(/*mustBeVisible*/true);
1377+
getPublicModuleName(/*onlyIfImported*/true);
13781378
nameComponents.push_back(publicName.str());
13791379
dc = dc->getParent();
13801380
}

lib/AST/Module.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,9 +1922,9 @@ ImportedModule::removeDuplicates(SmallVectorImpl<ImportedModule> &imports) {
19221922
imports.erase(last, imports.end());
19231923
}
19241924

1925-
Identifier ModuleDecl::getPublicModuleName(bool mustBeVisible) const {
1925+
Identifier ModuleDecl::getPublicModuleName(bool onlyIfImported) const {
19261926
if (!PublicModuleName.empty()) {
1927-
if (!mustBeVisible)
1927+
if (!onlyIfImported)
19281928
return PublicModuleName;
19291929

19301930
bool publicModuleIsImported =

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ void Serializer::writeHeader() {
11271127
}
11281128

11291129
Identifier publicModuleName =
1130-
M->getPublicModuleName(/*mustBeVisible=*/false);
1130+
M->getPublicModuleName(/*onlyIfImported=*/false);
11311131
if (publicModuleName != M->getName()) {
11321132
options_block::PublicModuleNameLayout PublicModuleName(Out);
11331133
PublicModuleName.emit(ScratchRecord, publicModuleName.str());

0 commit comments

Comments
 (0)