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);

lib/IRGen/GenClass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2035,7 +2035,7 @@ ClassDecl *IRGenModule::getObjCRuntimeBaseClass(Identifier name,
20352035
SwiftRootClass->computeType();
20362036
SwiftRootClass->setIsObjC(true);
20372037
SwiftRootClass->getAttrs().add(ObjCAttr::createNullary(Context, objcName,
2038-
/*implicit=*/true));
2038+
/*isNameImplicit=*/true));
20392039
SwiftRootClass->setImplicit();
20402040
SwiftRootClass->setAccessibility(Accessibility::Open);
20412041

lib/Parse/ParseExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1505,7 +1505,7 @@ ParserResult<Expr> Parser::parseExprPostfix(Diag<> ID, bool isExprBasic) {
15051505
}
15061506

15071507
DeclNameLoc NameLoc;
1508-
DeclName Name = parseUnqualifiedDeclName(/*allowDot=*/true,
1508+
DeclName Name = parseUnqualifiedDeclName(/*afterDot=*/true,
15091509
NameLoc,
15101510
diag::expected_member_name);
15111511
if (!Name) return nullptr;

lib/SIL/SILFunctionType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static CanType getKnownType(Optional<CanType> &cacheSlot, ASTContext &C,
106106
SmallVector<ValueDecl *, 2> decls;
107107
mod->lookupQualified(ModuleType::get(mod), C.getIdentifier(typeName),
108108
NL_QualifiedDefault | NL_KnownNonCascadingDependency,
109-
/*resolver=*/nullptr, decls);
109+
/*typeResolver=*/nullptr, decls);
110110
if (decls.size() != 1)
111111
return CanType();
112112

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ namespace {
17191719

17201720
if (!MaxIntegerTypeDecl) {
17211721
SmallVector<ValueDecl *, 1> lookupResults;
1722-
tc.getStdlibModule(dc)->lookupValue(/*filter=*/{},
1722+
tc.getStdlibModule(dc)->lookupValue(/*AccessPath=*/{},
17231723
tc.Context.Id_MaxBuiltinIntegerType,
17241724
NLKind::QualifiedLookup,
17251725
lookupResults);
@@ -1814,7 +1814,7 @@ namespace {
18141814
// FIXME: Cache name lookup.
18151815
if (!MaxFloatTypeDecl) {
18161816
SmallVector<ValueDecl *, 1> lookupResults;
1817-
tc.getStdlibModule(dc)->lookupValue(/*filter=*/{},
1817+
tc.getStdlibModule(dc)->lookupValue(/*AccessPath=*/{},
18181818
tc.Context.Id_MaxBuiltinFloatType,
18191819
NLKind::QualifiedLookup,
18201820
lookupResults);

lib/Sema/CodeSynthesis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ static ProtocolDecl *getNSCopyingProtocol(TypeChecker &TC,
565565
DC->lookupQualified(ModuleType::get(foundation),
566566
ctx.getSwiftId(KnownFoundationEntity::NSCopying),
567567
NL_QualifiedDefault | NL_KnownNonCascadingDependency,
568-
/*resolver=*/nullptr,
568+
/*typeResolver=*/nullptr,
569569
results);
570570

571571
if (results.size() != 1)

lib/Sema/ConstraintSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,
721721

722722
auto openedType = openFunctionType(
723723
func->getInterfaceType()->castTo<AnyFunctionType>(),
724-
/*numRemovedArgumentLabels=*/0,
724+
/*numArgumentLabelsToRemove=*/0,
725725
locator, replacements,
726726
func->getInnermostDeclContext(),
727727
func->getDeclContext(),

lib/Sema/TypeCheckDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,7 @@ static void inferObjCName(TypeChecker &tc, ValueDecl *decl) {
24882488
if (requirementObjCName) {
24892489
if (attr)
24902490
const_cast<ObjCAttr *>(attr)->setName(*requirementObjCName,
2491-
/*implicit=*/true);
2491+
/*implicitName=*/true);
24922492
else
24932493
decl->getAttrs().add(
24942494
ObjCAttr::create(tc.Context, *requirementObjCName,

lib/Serialization/Serialization.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4063,7 +4063,7 @@ static void addOperatorsAndTopLevel(Serializer &S, Range members,
40634063
if (isDerivedTopLevel) {
40644064
topLevelDecls[memberValue->getName()].push_back({
40654065
/*ignored*/0,
4066-
S.addDeclRef(memberValue, /*force=*/true)
4066+
S.addDeclRef(memberValue, /*forceSerialization=*/true)
40674067
});
40684068
} else if (memberValue->isOperator()) {
40694069
// Add operator methods.
@@ -4296,11 +4296,11 @@ withOutputFile(ASTContext &ctx, StringRef outputPath,
42964296
Clang.createOutputFile(outputPath, EC,
42974297
/*Binary=*/true,
42984298
/*RemoveFileOnSignal=*/true,
4299-
/*inputPath=*/"",
4299+
/*BaseInput=*/"",
43004300
path::extension(outputPath),
43014301
/*UseTemporary=*/true,
4302-
/*createDirs=*/false,
4303-
/*finalPath=*/nullptr,
4302+
/*CreateMissingDirectories=*/false,
4303+
/*ResultPathName=*/nullptr,
43044304
&tmpFilePath);
43054305

43064306
if (!out) {

stdlib/public/Reflection/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ class EnumTypeInfoBuilder {
890890
// NoPayloadEnumImplStrategy
891891
if (PayloadCases.empty()) {
892892
Kind = RecordKind::NoPayloadEnum;
893-
Size += getNumTagBytes(/*payloadSize=*/0,
893+
Size += getNumTagBytes(/*size=*/0,
894894
NoPayloadCases,
895895
/*payloadCases=*/0);
896896

stdlib/public/runtime/ProtocolConformance.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ swift::swift_conformsToProtocol(const Metadata * const type,
514514
if (protocol != P)
515515
continue;
516516

517-
if (!isRelatedType(type, metadata, /*isMetadata=*/true))
517+
if (!isRelatedType(type, metadata, /*candidateIsMetadata=*/true))
518518
continue;
519519

520520
// Store the type-protocol pair in the cache.
@@ -538,7 +538,7 @@ swift::swift_conformsToProtocol(const Metadata * const type,
538538
if (protocol != P)
539539
continue;
540540

541-
if (!isRelatedType(type, R, /*isMetadata=*/false))
541+
if (!isRelatedType(type, R, /*candidateIsMetadata=*/false))
542542
continue;
543543

544544
// Store the type-protocol pair in the cache.

0 commit comments

Comments
 (0)