Skip to content

Commit d88c188

Browse files
Merge pull request #6443 from practicalswift/argument-names
[gardening] Make sure argument names in comments match the actual parameter names
2 parents cc6fe4f + b253b21 commit d88c188

20 files changed

+42
-39
lines changed

lib/AST/ASTContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,8 @@ ClangModuleLoader *ASTContext::getClangModuleLoader() const {
12131213
static void recordKnownProtocol(Module *Stdlib, StringRef Name,
12141214
KnownProtocolKind Kind) {
12151215
Identifier ID = Stdlib->getASTContext().getIdentifier(Name);
1216-
UnqualifiedLookup Lookup(ID, Stdlib, nullptr, /*NonCascading=*/true,
1217-
SourceLoc(), /*IsType=*/true);
1216+
UnqualifiedLookup Lookup(ID, Stdlib, nullptr, /*IsKnownPrivate=*/true,
1217+
SourceLoc(), /*IsTypeLookup=*/true);
12181218
if (auto Proto
12191219
= dyn_cast_or_null<ProtocolDecl>(Lookup.getSingleTypeResult()))
12201220
Proto->setKnownProtocolKind(Kind);

lib/AST/DeclContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ void IterableDeclContext::loadAllMembers() const {
917917
// Don't try to load all members re-entrant-ly.
918918
ASTContext &ctx = getASTContext();
919919
auto contextInfo = ctx.getOrCreateLazyIterableContextData(this,
920-
/*loader=*/nullptr);
920+
/*lazyLoader=*/nullptr);
921921
FirstDeclAndLazyMembers.setInt(false);
922922

923923
const Decl *container = nullptr;

lib/AST/DocComment.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ getProtocolRequirementDocComment(swift::markup::MarkupContext &MC,
404404
SmallVector<ValueDecl *, 2> Members;
405405
P->lookupQualified(P->getDeclaredType(), VD->getFullName(),
406406
NLOptions::NL_ProtocolMembers,
407-
/*resolver=*/nullptr, Members);
407+
/*typeResolver=*/nullptr, Members);
408408
SmallVector<const ValueDecl *, 1> ProtocolRequirements;
409409
for (auto Member : Members)
410410
if (!Member->isDefinition())

lib/AST/NameLookup.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,9 +462,10 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
462462
if (Name.isOperator()) {
463463
if (!isCascadingUse.hasValue()) {
464464
DeclContext *innermostDC =
465-
lookupScope->getInnermostEnclosingDeclContext();
465+
lookupScope->getInnermostEnclosingDeclContext();
466466
isCascadingUse =
467-
innermostDC->isCascadingContextForLookup(/*excludeFunctions=*/true);
467+
innermostDC->isCascadingContextForLookup(
468+
/*functionsAreNonCascading=*/true);
468469
}
469470

470471
lookupScope = &sourceFile.getScope();
@@ -502,7 +503,7 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
502503
// If we haven't determined whether we have a cascading use, do so now.
503504
if (!isCascadingUse.hasValue()) {
504505
isCascadingUse =
505-
dc->isCascadingContextForLookup(/*excludeFunctions=*/false);
506+
dc->isCascadingContextForLookup(/*functionsAreNonCascading=*/false);
506507
}
507508

508509
// Pattern binding initializers are only interesting insofar as they
@@ -662,7 +663,7 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
662663
if (Name.isOperator()) {
663664
if (!isCascadingUse.hasValue()) {
664665
isCascadingUse =
665-
DC->isCascadingContextForLookup(/*excludeFunctions=*/true);
666+
DC->isCascadingContextForLookup(/*functionsAreNonCascading=*/true);
666667
}
667668
DC = DC->getModuleScopeContext();
668669

@@ -1342,7 +1343,7 @@ bool DeclContext::lookupQualified(Type type,
13421343
auto checkLookupCascading = [this, options]() -> Optional<bool> {
13431344
switch (static_cast<unsigned>(options & NL_KnownDependencyMask)) {
13441345
case 0:
1345-
return isCascadingContextForLookup(/*excludeFunctions=*/false);
1346+
return isCascadingContextForLookup(/*functionsAreNonCascading=*/false);
13461347
case NL_KnownNonCascadingDependency:
13471348
return false;
13481349
case NL_KnownCascadingDependency:

lib/AST/Type.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static Type getStrippedType(const ASTContext &context, Type type,
710710
}
711711

712712
Type TypeBase::getUnlabeledType(ASTContext &Context) {
713-
return getStrippedType(Context, Type(this), /*labels=*/true);
713+
return getStrippedType(Context, Type(this), /*stripLabels=*/true);
714714
}
715715

716716
Type TypeBase::getWithoutParens() {

lib/ClangImporter/ClangDiagnosticConsumer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ SourceLoc ClangDiagnosticConsumer::resolveSourceLocation(
112112
std::unique_ptr<llvm::MemoryBuffer> mirrorBuffer{
113113
llvm::MemoryBuffer::getMemBuffer(buffer->getBuffer(),
114114
buffer->getBufferIdentifier(),
115-
/*nullTerminated=*/true)
115+
/*RequiresNullTerminator=*/true)
116116
};
117117
mirrorID = swiftSrcMgr.addNewSourceBuffer(std::move(mirrorBuffer));
118118
mirroredBuffers[buffer] = mirrorID;

lib/ClangImporter/ClangImporter.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace {
8383
if (!imported)
8484
return;
8585
Module *nativeImported = Impl.finishLoadingClangModule(Importer, imported,
86-
/*adapter=*/true);
86+
/*preferAdapter=*/true);
8787
Impl.ImportedHeaderExports.push_back({ /*filter=*/{}, nativeImported });
8888
}
8989

@@ -846,7 +846,7 @@ bool ClangImporter::Implementation::importHeader(
846846
static_cast<HeaderParsingASTConsumer &>(Instance->getASTConsumer());
847847
consumer.reset();
848848

849-
pp.EnterSourceFile(bufferID, /*directoryLookup=*/nullptr, /*Loc=*/{});
849+
pp.EnterSourceFile(bufferID, /*Dir=*/nullptr, /*Loc=*/{});
850850
// Force the import to occur.
851851
pp.LookAhead(0);
852852

@@ -909,7 +909,7 @@ bool ClangImporter::importHeader(StringRef header, Module *adapter,
909909
StringRef cachedContents, SourceLoc diagLoc) {
910910
clang::FileManager &fileManager = Impl.Instance->getFileManager();
911911
const clang::FileEntry *headerFile = fileManager.getFile(header,
912-
/*open=*/true);
912+
/*OpenFile=*/true);
913913
if (headerFile && headerFile->getSize() == expectedSize &&
914914
headerFile->getModificationTime() == expectedModTime) {
915915
return importBridgingHeader(header, adapter, diagLoc);
@@ -929,7 +929,7 @@ bool ClangImporter::importBridgingHeader(StringRef header, Module *adapter,
929929
bool trackParsedSymbols) {
930930
clang::FileManager &fileManager = Impl.Instance->getFileManager();
931931
const clang::FileEntry *headerFile = fileManager.getFile(header,
932-
/*open=*/true);
932+
/*OpenFile=*/true);
933933
if (!headerFile) {
934934
Impl.SwiftContext.Diags.diagnose(diagLoc, diag::bridging_header_missing,
935935
header);
@@ -1090,7 +1090,8 @@ Module *ClangImporter::loadModule(
10901090
if (!clangModule)
10911091
return nullptr;
10921092

1093-
return Impl.finishLoadingClangModule(*this, clangModule, /*adapter=*/false);
1093+
return Impl.finishLoadingClangModule(*this, clangModule,
1094+
/*preferAdapter=*/false);
10941095
}
10951096

10961097
Module *ClangImporter::Implementation::finishLoadingClangModule(
@@ -2168,11 +2169,11 @@ void ClangModuleUnit::lookupObjCMethods(
21682169
auto &clangSema = owner.Impl.getClangSema();
21692170
clangSema.CollectMultipleMethodsInGlobalPool(clangSelector,
21702171
objcMethods,
2171-
/*instance=*/true,
2172+
/*InstanceFirst=*/true,
21722173
/*CheckTheOther=*/false);
21732174
clangSema.CollectMultipleMethodsInGlobalPool(clangSelector,
21742175
objcMethods,
2175-
/*instance=*/false,
2176+
/*InstanceFirst=*/false,
21762177
/*CheckTheOther=*/false);
21772178

21782179
// Import the methods.

lib/ClangImporter/ImportDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3114,7 +3114,7 @@ namespace {
31143114
/// The importer should use this rather than adding the attribute directly.
31153115
void addObjCAttribute(ValueDecl *decl, Optional<ObjCSelector> name) {
31163116
auto &ctx = Impl.SwiftContext;
3117-
decl->getAttrs().add(ObjCAttr::create(ctx, name, /*implicit=*/true));
3117+
decl->getAttrs().add(ObjCAttr::create(ctx, name, /*implicitName=*/true));
31183118

31193119
// If the declaration we attached the 'objc' attribute to is within a
31203120
// class, record it in the class.

lib/FrontendTool/FrontendTool.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ static bool printAsObjC(const std::string &outputPath, Module *M,
153153
Clang.createOutputFile(outputPath, EC,
154154
/*Binary=*/false,
155155
/*RemoveFileOnSignal=*/true,
156-
/*inputPath=*/"",
156+
/*BaseInput=*/"",
157157
path::extension(outputPath),
158158
/*UseTemporary=*/true,
159-
/*createDirs=*/false,
160-
/*finalPath=*/nullptr,
159+
/*CreateMissingDirectories=*/false,
160+
/*ResultPathName=*/nullptr,
161161
&tmpFilePath);
162162

163163
if (!out) {

lib/FrontendTool/ReferenceDependencies.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,12 @@ static bool extendedTypeIsPrivate(TypeLoc inheritedType) {
9999
}
100100

101101
static std::string mangleTypeAsContext(const NominalTypeDecl *type) {
102-
Mangle::Mangler mangler(/*debug style=*/false, /*Unicode=*/true);
102+
Mangle::Mangler mangler(/*debug style=*/false, /*usePunycode=*/true);
103103
mangler.mangleContext(type);
104104
std::string Old = mangler.finalize();
105105

106-
NewMangling::ASTMangler NewMangler(/*debug style=*/false, /*Unicode=*/true);
106+
NewMangling::ASTMangler NewMangler(/*debug style=*/false,
107+
/*usePunycode=*/true);
107108
std::string New = NewMangler.mangleTypeAsContextUSR(type);
108109

109110
return NewMangling::selectMangling(Old, New);

0 commit comments

Comments
 (0)