Skip to content

[gardening] Make sure argument names in comments match the actual parameter names #6443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1213,8 +1213,8 @@ ClangModuleLoader *ASTContext::getClangModuleLoader() const {
static void recordKnownProtocol(Module *Stdlib, StringRef Name,
KnownProtocolKind Kind) {
Identifier ID = Stdlib->getASTContext().getIdentifier(Name);
UnqualifiedLookup Lookup(ID, Stdlib, nullptr, /*NonCascading=*/true,
SourceLoc(), /*IsType=*/true);
UnqualifiedLookup Lookup(ID, Stdlib, nullptr, /*IsKnownPrivate=*/true,
SourceLoc(), /*IsTypeLookup=*/true);
if (auto Proto
= dyn_cast_or_null<ProtocolDecl>(Lookup.getSingleTypeResult()))
Proto->setKnownProtocolKind(Kind);
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/DeclContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ void IterableDeclContext::loadAllMembers() const {
// Don't try to load all members re-entrant-ly.
ASTContext &ctx = getASTContext();
auto contextInfo = ctx.getOrCreateLazyIterableContextData(this,
/*loader=*/nullptr);
/*lazyLoader=*/nullptr);
FirstDeclAndLazyMembers.setInt(false);

const Decl *container = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/DocComment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ getProtocolRequirementDocComment(swift::markup::MarkupContext &MC,
SmallVector<ValueDecl *, 2> Members;
P->lookupQualified(P->getDeclaredType(), VD->getFullName(),
NLOptions::NL_ProtocolMembers,
/*resolver=*/nullptr, Members);
/*typeResolver=*/nullptr, Members);
SmallVector<const ValueDecl *, 1> ProtocolRequirements;
for (auto Member : Members)
if (!Member->isDefinition())
Expand Down
11 changes: 6 additions & 5 deletions lib/AST/NameLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,10 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
if (Name.isOperator()) {
if (!isCascadingUse.hasValue()) {
DeclContext *innermostDC =
lookupScope->getInnermostEnclosingDeclContext();
lookupScope->getInnermostEnclosingDeclContext();
isCascadingUse =
innermostDC->isCascadingContextForLookup(/*excludeFunctions=*/true);
innermostDC->isCascadingContextForLookup(
/*functionsAreNonCascading=*/true);
}

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

// Pattern binding initializers are only interesting insofar as they
Expand Down Expand Up @@ -662,7 +663,7 @@ UnqualifiedLookup::UnqualifiedLookup(DeclName Name, DeclContext *DC,
if (Name.isOperator()) {
if (!isCascadingUse.hasValue()) {
isCascadingUse =
DC->isCascadingContextForLookup(/*excludeFunctions=*/true);
DC->isCascadingContextForLookup(/*functionsAreNonCascading=*/true);
}
DC = DC->getModuleScopeContext();

Expand Down Expand Up @@ -1342,7 +1343,7 @@ bool DeclContext::lookupQualified(Type type,
auto checkLookupCascading = [this, options]() -> Optional<bool> {
switch (static_cast<unsigned>(options & NL_KnownDependencyMask)) {
case 0:
return isCascadingContextForLookup(/*excludeFunctions=*/false);
return isCascadingContextForLookup(/*functionsAreNonCascading=*/false);
case NL_KnownNonCascadingDependency:
return false;
case NL_KnownCascadingDependency:
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ static Type getStrippedType(const ASTContext &context, Type type,
}

Type TypeBase::getUnlabeledType(ASTContext &Context) {
return getStrippedType(Context, Type(this), /*labels=*/true);
return getStrippedType(Context, Type(this), /*stripLabels=*/true);
}

Type TypeBase::getWithoutParens() {
Expand Down
2 changes: 1 addition & 1 deletion lib/ClangImporter/ClangDiagnosticConsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ SourceLoc ClangDiagnosticConsumer::resolveSourceLocation(
std::unique_ptr<llvm::MemoryBuffer> mirrorBuffer{
llvm::MemoryBuffer::getMemBuffer(buffer->getBuffer(),
buffer->getBufferIdentifier(),
/*nullTerminated=*/true)
/*RequiresNullTerminator=*/true)
};
mirrorID = swiftSrcMgr.addNewSourceBuffer(std::move(mirrorBuffer));
mirroredBuffers[buffer] = mirrorID;
Expand Down
15 changes: 8 additions & 7 deletions lib/ClangImporter/ClangImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace {
if (!imported)
return;
Module *nativeImported = Impl.finishLoadingClangModule(Importer, imported,
/*adapter=*/true);
/*preferAdapter=*/true);
Impl.ImportedHeaderExports.push_back({ /*filter=*/{}, nativeImported });
}

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

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

Expand Down Expand Up @@ -909,7 +909,7 @@ bool ClangImporter::importHeader(StringRef header, Module *adapter,
StringRef cachedContents, SourceLoc diagLoc) {
clang::FileManager &fileManager = Impl.Instance->getFileManager();
const clang::FileEntry *headerFile = fileManager.getFile(header,
/*open=*/true);
/*OpenFile=*/true);
if (headerFile && headerFile->getSize() == expectedSize &&
headerFile->getModificationTime() == expectedModTime) {
return importBridgingHeader(header, adapter, diagLoc);
Expand All @@ -929,7 +929,7 @@ bool ClangImporter::importBridgingHeader(StringRef header, Module *adapter,
bool trackParsedSymbols) {
clang::FileManager &fileManager = Impl.Instance->getFileManager();
const clang::FileEntry *headerFile = fileManager.getFile(header,
/*open=*/true);
/*OpenFile=*/true);
if (!headerFile) {
Impl.SwiftContext.Diags.diagnose(diagLoc, diag::bridging_header_missing,
header);
Expand Down Expand Up @@ -1090,7 +1090,8 @@ Module *ClangImporter::loadModule(
if (!clangModule)
return nullptr;

return Impl.finishLoadingClangModule(*this, clangModule, /*adapter=*/false);
return Impl.finishLoadingClangModule(*this, clangModule,
/*preferAdapter=*/false);
}

Module *ClangImporter::Implementation::finishLoadingClangModule(
Expand Down Expand Up @@ -2168,11 +2169,11 @@ void ClangModuleUnit::lookupObjCMethods(
auto &clangSema = owner.Impl.getClangSema();
clangSema.CollectMultipleMethodsInGlobalPool(clangSelector,
objcMethods,
/*instance=*/true,
/*InstanceFirst=*/true,
/*CheckTheOther=*/false);
clangSema.CollectMultipleMethodsInGlobalPool(clangSelector,
objcMethods,
/*instance=*/false,
/*InstanceFirst=*/false,
/*CheckTheOther=*/false);

// Import the methods.
Expand Down
2 changes: 1 addition & 1 deletion lib/ClangImporter/ImportDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3114,7 +3114,7 @@ namespace {
/// The importer should use this rather than adding the attribute directly.
void addObjCAttribute(ValueDecl *decl, Optional<ObjCSelector> name) {
auto &ctx = Impl.SwiftContext;
decl->getAttrs().add(ObjCAttr::create(ctx, name, /*implicit=*/true));
decl->getAttrs().add(ObjCAttr::create(ctx, name, /*implicitName=*/true));

// If the declaration we attached the 'objc' attribute to is within a
// class, record it in the class.
Expand Down
6 changes: 3 additions & 3 deletions lib/FrontendTool/FrontendTool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ static bool printAsObjC(const std::string &outputPath, Module *M,
Clang.createOutputFile(outputPath, EC,
/*Binary=*/false,
/*RemoveFileOnSignal=*/true,
/*inputPath=*/"",
/*BaseInput=*/"",
path::extension(outputPath),
/*UseTemporary=*/true,
/*createDirs=*/false,
/*finalPath=*/nullptr,
/*CreateMissingDirectories=*/false,
/*ResultPathName=*/nullptr,
&tmpFilePath);

if (!out) {
Expand Down
5 changes: 3 additions & 2 deletions lib/FrontendTool/ReferenceDependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ static bool extendedTypeIsPrivate(TypeLoc inheritedType) {
}

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

NewMangling::ASTMangler NewMangler(/*debug style=*/false, /*Unicode=*/true);
NewMangling::ASTMangler NewMangler(/*debug style=*/false,
/*usePunycode=*/true);
std::string New = NewMangler.mangleTypeAsContextUSR(type);

return NewMangling::selectMangling(Old, New);
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/GenClass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2035,7 +2035,7 @@ ClassDecl *IRGenModule::getObjCRuntimeBaseClass(Identifier name,
SwiftRootClass->computeType();
SwiftRootClass->setIsObjC(true);
SwiftRootClass->getAttrs().add(ObjCAttr::createNullary(Context, objcName,
/*implicit=*/true));
/*isNameImplicit=*/true));
SwiftRootClass->setImplicit();
SwiftRootClass->setAccessibility(Accessibility::Open);

Expand Down
2 changes: 1 addition & 1 deletion lib/Parse/ParseExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ ParserResult<Expr> Parser::parseExprPostfix(Diag<> ID, bool isExprBasic) {
}

DeclNameLoc NameLoc;
DeclName Name = parseUnqualifiedDeclName(/*allowDot=*/true,
DeclName Name = parseUnqualifiedDeclName(/*afterDot=*/true,
NameLoc,
diag::expected_member_name);
if (!Name) return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion lib/SIL/SILFunctionType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static CanType getKnownType(Optional<CanType> &cacheSlot, ASTContext &C,
SmallVector<ValueDecl *, 2> decls;
mod->lookupQualified(ModuleType::get(mod), C.getIdentifier(typeName),
NL_QualifiedDefault | NL_KnownNonCascadingDependency,
/*resolver=*/nullptr, decls);
/*typeResolver=*/nullptr, decls);
if (decls.size() != 1)
return CanType();

Expand Down
4 changes: 2 additions & 2 deletions lib/Sema/CSApply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1719,7 +1719,7 @@ namespace {

if (!MaxIntegerTypeDecl) {
SmallVector<ValueDecl *, 1> lookupResults;
tc.getStdlibModule(dc)->lookupValue(/*filter=*/{},
tc.getStdlibModule(dc)->lookupValue(/*AccessPath=*/{},
tc.Context.Id_MaxBuiltinIntegerType,
NLKind::QualifiedLookup,
lookupResults);
Expand Down Expand Up @@ -1814,7 +1814,7 @@ namespace {
// FIXME: Cache name lookup.
if (!MaxFloatTypeDecl) {
SmallVector<ValueDecl *, 1> lookupResults;
tc.getStdlibModule(dc)->lookupValue(/*filter=*/{},
tc.getStdlibModule(dc)->lookupValue(/*AccessPath=*/{},
tc.Context.Id_MaxBuiltinFloatType,
NLKind::QualifiedLookup,
lookupResults);
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/CodeSynthesis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ static ProtocolDecl *getNSCopyingProtocol(TypeChecker &TC,
DC->lookupQualified(ModuleType::get(foundation),
ctx.getSwiftId(KnownFoundationEntity::NSCopying),
NL_QualifiedDefault | NL_KnownNonCascadingDependency,
/*resolver=*/nullptr,
/*typeResolver=*/nullptr,
results);

if (results.size() != 1)
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/ConstraintSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ ConstraintSystem::getTypeOfReference(ValueDecl *value,

auto openedType = openFunctionType(
func->getInterfaceType()->castTo<AnyFunctionType>(),
/*numRemovedArgumentLabels=*/0,
/*numArgumentLabelsToRemove=*/0,
locator, replacements,
func->getInnermostDeclContext(),
func->getDeclContext(),
Expand Down
2 changes: 1 addition & 1 deletion lib/Sema/TypeCheckDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ static void inferObjCName(TypeChecker &tc, ValueDecl *decl) {
if (requirementObjCName) {
if (attr)
const_cast<ObjCAttr *>(attr)->setName(*requirementObjCName,
/*implicit=*/true);
/*implicitName=*/true);
else
decl->getAttrs().add(
ObjCAttr::create(tc.Context, *requirementObjCName,
Expand Down
8 changes: 4 additions & 4 deletions lib/Serialization/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4063,7 +4063,7 @@ static void addOperatorsAndTopLevel(Serializer &S, Range members,
if (isDerivedTopLevel) {
topLevelDecls[memberValue->getName()].push_back({
/*ignored*/0,
S.addDeclRef(memberValue, /*force=*/true)
S.addDeclRef(memberValue, /*forceSerialization=*/true)
});
} else if (memberValue->isOperator()) {
// Add operator methods.
Expand Down Expand Up @@ -4296,11 +4296,11 @@ withOutputFile(ASTContext &ctx, StringRef outputPath,
Clang.createOutputFile(outputPath, EC,
/*Binary=*/true,
/*RemoveFileOnSignal=*/true,
/*inputPath=*/"",
/*BaseInput=*/"",
path::extension(outputPath),
/*UseTemporary=*/true,
/*createDirs=*/false,
/*finalPath=*/nullptr,
/*CreateMissingDirectories=*/false,
/*ResultPathName=*/nullptr,
&tmpFilePath);

if (!out) {
Expand Down
2 changes: 1 addition & 1 deletion stdlib/public/Reflection/TypeLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ class EnumTypeInfoBuilder {
// NoPayloadEnumImplStrategy
if (PayloadCases.empty()) {
Kind = RecordKind::NoPayloadEnum;
Size += getNumTagBytes(/*payloadSize=*/0,
Size += getNumTagBytes(/*size=*/0,
NoPayloadCases,
/*payloadCases=*/0);

Expand Down
4 changes: 2 additions & 2 deletions stdlib/public/runtime/ProtocolConformance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ swift::swift_conformsToProtocol(const Metadata * const type,
if (protocol != P)
continue;

if (!isRelatedType(type, metadata, /*isMetadata=*/true))
if (!isRelatedType(type, metadata, /*candidateIsMetadata=*/true))
continue;

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

if (!isRelatedType(type, R, /*isMetadata=*/false))
if (!isRelatedType(type, R, /*candidateIsMetadata=*/false))
continue;

// Store the type-protocol pair in the cache.
Expand Down