Skip to content

Commit 37e82a6

Browse files
committed
[NFC] getWitnessMethodConformanceOrNone -> getWitnessMethodConformanceOrInvalid
1 parent 3e1a61f commit 37e82a6

File tree

15 files changed

+38
-45
lines changed

15 files changed

+38
-45
lines changed

include/swift/AST/Types.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4104,7 +4104,7 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
41044104
/// If this is a @convention(witness_method) function, return the conformance
41054105
/// for which the method is a witness. If it isn't that convention, return
41064106
/// an invalid conformance.
4107-
ProtocolConformanceRef getWitnessMethodConformanceOrNone() const {
4107+
ProtocolConformanceRef getWitnessMethodConformanceOrInvalid() const {
41084108
return WitnessMethodConformance;
41094109
}
41104110

@@ -4199,11 +4199,9 @@ class SILFunctionType final : public TypeBase, public llvm::FoldingSetNode,
41994199

42004200
void Profile(llvm::FoldingSetNodeID &ID) {
42014201
Profile(ID, getSubstGenericSignature(), getExtInfo(), getCoroutineKind(),
4202-
getCalleeConvention(), getParameters(), getYields(),
4203-
getResults(), getOptionalErrorResult(),
4204-
getWitnessMethodConformanceOrNone(),
4205-
isGenericSignatureImplied(),
4206-
getSubstitutions());
4202+
getCalleeConvention(), getParameters(), getYields(), getResults(),
4203+
getOptionalErrorResult(), getWitnessMethodConformanceOrInvalid(),
4204+
isGenericSignatureImplied(), getSubstitutions());
42074205
}
42084206
static void
42094207
Profile(llvm::FoldingSetNodeID &ID, GenericSignature genericSig, ExtInfo info,

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4000,7 +4000,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
40004000
void visitSILFunctionType(SILFunctionType *T) {
40014001
printSILCoroutineKind(T->getCoroutineKind());
40024002
printFunctionExtInfo(T->getExtInfo(),
4003-
T->getWitnessMethodConformanceOrNone());
4003+
T->getWitnessMethodConformanceOrInvalid());
40044004
printCalleeConvention(T->getCalleeConvention());
40054005
if (auto sig = T->getSubstGenericSignature()) {
40064006
printGenericSignature(sig,

lib/IRGen/GenProto.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ bool PolymorphicConvention::considerType(CanType type, IsExact_t isExact,
323323

324324
void PolymorphicConvention::considerWitnessSelf(CanSILFunctionType fnType) {
325325
CanType selfTy = fnType->getSelfInstanceType(IGM.getSILModule());
326-
auto conformance = fnType->getWitnessMethodConformanceOrNone();
326+
auto conformance = fnType->getWitnessMethodConformanceOrInvalid();
327327

328328
// First, bind type metadata for Self.
329329
Sources.emplace_back(MetadataSource::Kind::SelfMetadata,
@@ -564,7 +564,7 @@ void EmitPolymorphicParameters::bindExtraSource(const MetadataSource &source,
564564
assert(selfTable && "no Self witness table for witness method");
565565

566566
// Mark this as the cached witness table for Self.
567-
auto conformance = FnType->getWitnessMethodConformanceOrNone();
567+
auto conformance = FnType->getWitnessMethodConformanceOrInvalid();
568568
auto selfProto = conformance.getRequirement();
569569

570570
auto selfTy = FnType->getSelfInstanceType(IGM.getSILModule());

lib/IRGen/IRGenSIL.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2123,7 +2123,8 @@ emitWitnessTableForLoweredCallee(IRGenSILFunction &IGF,
21232123
// This use of getSelfInstanceType() assumes that the instance type is
21242124
// always a meaningful formal type.
21252125
auto substSelfType = substCalleeType->getSelfInstanceType(IGF.IGM.getSILModule());
2126-
auto substConformance = substCalleeType->getWitnessMethodConformanceOrNone();
2126+
auto substConformance =
2127+
substCalleeType->getWitnessMethodConformanceOrInvalid();
21272128

21282129
llvm::Value *argMetadata = IGF.emitTypeMetadataRef(substSelfType);
21292130
llvm::Value *wtable =

lib/IRGen/LoadableByAddress.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ LargeSILTypeMapper::getNewSILFunctionType(GenericEnvironment *env,
286286
fnType->getSubstitutions(),
287287
fnType->isGenericSignatureImplied(),
288288
fnType->getASTContext(),
289-
fnType->getWitnessMethodConformanceOrNone());
289+
fnType->getWitnessMethodConformanceOrInvalid());
290290
return newFnType;
291291
}
292292

@@ -2317,7 +2317,7 @@ static bool rewriteFunctionReturn(StructLoweringState &pass) {
23172317
newSILResultInfo, loweredTy->getOptionalErrorResult(),
23182318
loweredTy->getSubstitutions(), loweredTy->isGenericSignatureImplied(),
23192319
F->getModule().getASTContext(),
2320-
loweredTy->getWitnessMethodConformanceOrNone());
2320+
loweredTy->getWitnessMethodConformanceOrInvalid());
23212321
F->rewriteLoweredTypeUnsafe(NewTy);
23222322
return true;
23232323
}

lib/SIL/SILFunctionType.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Lowering::adjustFunctionType(CanSILFunctionType type,
214214
ParameterConvention callee,
215215
ProtocolConformanceRef witnessMethodConformance) {
216216
if (type->getExtInfo() == extInfo && type->getCalleeConvention() == callee &&
217-
type->getWitnessMethodConformanceOrNone() == witnessMethodConformance)
217+
type->getWitnessMethodConformanceOrInvalid() == witnessMethodConformance)
218218
return type;
219219

220220
return SILFunctionType::get(type->getSubstGenericSignature(),
@@ -246,11 +246,10 @@ CanSILFunctionType SILFunctionType::getWithExtInfo(ExtInfo newExt) {
246246
: ParameterConvention::Direct_Unowned);
247247

248248
return get(getSubstGenericSignature(), newExt, getCoroutineKind(),
249-
calleeConvention, getParameters(), getYields(),
250-
getResults(), getOptionalErrorResult(),
251-
getSubstitutions(), isGenericSignatureImplied(),
252-
getASTContext(),
253-
getWitnessMethodConformanceOrNone());
249+
calleeConvention, getParameters(), getYields(), getResults(),
250+
getOptionalErrorResult(), getSubstitutions(),
251+
isGenericSignatureImplied(), getASTContext(),
252+
getWitnessMethodConformanceOrInvalid());
254253
}
255254

256255
namespace {
@@ -2424,7 +2423,7 @@ class SILTypeSubstituter :
24242423
}
24252424

24262425
auto witnessMethodConformance = ProtocolConformanceRef::forInvalid();
2427-
auto conformance = origType->getWitnessMethodConformanceOrNone();
2426+
auto conformance = origType->getWitnessMethodConformanceOrInvalid();
24282427
if (!conformance.isInvalid()) {
24292428
assert(origType->getExtInfo().hasSelfParam());
24302429
auto selfType = origType->getSelfParameter().getInterfaceType();

lib/SILGen/SILGenBridging.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ SILGenFunction::emitBlockToFunc(SILLocation loc,
927927

928928
auto loweredFuncTyWithoutNoEscape = adjustFunctionType(
929929
loweredFuncTy, loweredFuncTy->getExtInfo().withNoEscape(false),
930-
loweredFuncTy->getWitnessMethodConformanceOrNone());
930+
loweredFuncTy->getWitnessMethodConformanceOrInvalid());
931931

932932
CanType dynamicSelfType;
933933
auto thunkTy = buildThunkType(loweredBlockTy, loweredFuncTyWithoutNoEscape,

lib/SILGen/SILGenPoly.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3385,7 +3385,7 @@ ManagedValue Transform::transformFunction(ManagedValue fn,
33853385
: expectedFnType->isNoEscape());
33863386
auto newFnType =
33873387
adjustFunctionType(expectedFnType, newEI, fnType->getCalleeConvention(),
3388-
fnType->getWitnessMethodConformanceOrNone());
3388+
fnType->getWitnessMethodConformanceOrInvalid());
33893389

33903390
// Apply any ABI-compatible conversions before doing thin-to-thick or
33913391
// escaping->noescape conversion.

lib/SILOptimizer/FunctionSignatureTransforms/ExistentialTransform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ ExistentialTransform::createExistentialSpecializedFunctionType() {
362362
/// Finally the ExtInfo.
363363
auto ExtInfo = FTy->getExtInfo();
364364
ExtInfo = ExtInfo.withRepresentation(SILFunctionTypeRepresentation::Thin);
365-
auto witnessMethodConformance = FTy->getWitnessMethodConformanceOrNone();
365+
auto witnessMethodConformance = FTy->getWitnessMethodConformanceOrInvalid();
366366

367367
/// Return the new signature.
368368
return SILFunctionType::get(

lib/SILOptimizer/FunctionSignatureTransforms/FunctionSignatureOpts.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ FunctionSignatureTransformDescriptor::createOptimizedSILFunctionType() {
378378

379379
// Don't use a method representation if we modified self.
380380
auto ExtInfo = FTy->getExtInfo();
381-
auto witnessMethodConformance = FTy->getWitnessMethodConformanceOrNone();
381+
auto witnessMethodConformance = FTy->getWitnessMethodConformanceOrInvalid();
382382
if (shouldModifySelfArgument) {
383383
ExtInfo = ExtInfo.withRepresentation(SILFunctionTypeRepresentation::Thin);
384384
witnessMethodConformance = ProtocolConformanceRef::forInvalid();

lib/SILOptimizer/IPO/CapturePromotion.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,10 +427,9 @@ ClosureCloner::initCloned(SILOptFunctionBuilder &FunctionBuilder,
427427
auto ClonedTy = SILFunctionType::get(
428428
OrigFTI->getInvocationGenericSignature(), OrigFTI->getExtInfo(),
429429
OrigFTI->getCoroutineKind(), OrigFTI->getCalleeConvention(),
430-
ClonedInterfaceArgTys, OrigFTI->getYields(),
431-
OrigFTI->getResults(), OrigFTI->getOptionalErrorResult(),
432-
SubstitutionMap(), false,
433-
M.getASTContext(), OrigFTI->getWitnessMethodConformanceOrNone());
430+
ClonedInterfaceArgTys, OrigFTI->getYields(), OrigFTI->getResults(),
431+
OrigFTI->getOptionalErrorResult(), SubstitutionMap(), false,
432+
M.getASTContext(), OrigFTI->getWitnessMethodConformanceOrInvalid());
434433

435434
assert((Orig->isTransparent() || Orig->isBare() || Orig->getLocation())
436435
&& "SILFunction missing location");

lib/SILOptimizer/Transforms/AllocBoxToStack.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,10 +601,10 @@ SILFunction *PromotedParamCloner::initCloned(SILOptFunctionBuilder &FuncBuilder,
601601
auto ClonedTy = SILFunctionType::get(
602602
OrigFTI->getSubstGenericSignature(), OrigFTI->getExtInfo(),
603603
OrigFTI->getCoroutineKind(), OrigFTI->getCalleeConvention(),
604-
ClonedInterfaceArgTys, OrigFTI->getYields(),
605-
OrigFTI->getResults(), OrigFTI->getOptionalErrorResult(),
606-
OrigFTI->getSubstitutions(), OrigFTI->isGenericSignatureImplied(),
607-
M.getASTContext(), OrigFTI->getWitnessMethodConformanceOrNone());
604+
ClonedInterfaceArgTys, OrigFTI->getYields(), OrigFTI->getResults(),
605+
OrigFTI->getOptionalErrorResult(), OrigFTI->getSubstitutions(),
606+
OrigFTI->isGenericSignatureImplied(), M.getASTContext(),
607+
OrigFTI->getWitnessMethodConformanceOrInvalid());
608608

609609
assert((Orig->isTransparent() || Orig->isBare() || Orig->getLocation())
610610
&& "SILFunction missing location");

lib/SILOptimizer/Utils/ConstExpr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ ConstExprFunctionState::computeCallResult(ApplyInst *apply) {
11331133
if (calleeFnType->getRepresentation() ==
11341134
SILFunctionType::Representation::WitnessMethod) {
11351135
auto protocol =
1136-
calleeFnType->getWitnessMethodConformanceOrNone().getRequirement();
1136+
calleeFnType->getWitnessMethodConformanceOrInvalid().getRequirement();
11371137
// Compute a mapping that maps the Self type of the protocol given by
11381138
// 'requirement' to the concrete type available in the substitutionMap.
11391139
auto protoSelfToConcreteType =

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -772,12 +772,10 @@ ReabstractionInfo::createSubstitutedType(SILFunction *OrigF,
772772

773773
// Use the new specialized generic signature.
774774
auto NewFnTy = SILFunctionType::get(
775-
CanSpecializedGenericSig, FnTy->getExtInfo(),
776-
FnTy->getCoroutineKind(), FnTy->getCalleeConvention(),
777-
FnTy->getParameters(), FnTy->getYields(),
778-
FnTy->getResults(), FnTy->getOptionalErrorResult(),
779-
SubstitutionMap(), false,
780-
M.getASTContext(), FnTy->getWitnessMethodConformanceOrNone());
775+
CanSpecializedGenericSig, FnTy->getExtInfo(), FnTy->getCoroutineKind(),
776+
FnTy->getCalleeConvention(), FnTy->getParameters(), FnTy->getYields(),
777+
FnTy->getResults(), FnTy->getOptionalErrorResult(), SubstitutionMap(),
778+
false, M.getASTContext(), FnTy->getWitnessMethodConformanceOrInvalid());
781779

782780
// This is an interface type. It should not have any archetypes.
783781
assert(!NewFnTy->hasArchetype());
@@ -846,13 +844,11 @@ createSpecializedType(CanSILFunctionType SubstFTy, SILModule &M) const {
846844
SpecializedYields.push_back(YI);
847845
}
848846
return SILFunctionType::get(
849-
SubstFTy->getInvocationGenericSignature(),
850-
SubstFTy->getExtInfo(), SubstFTy->getCoroutineKind(),
851-
SubstFTy->getCalleeConvention(),
847+
SubstFTy->getInvocationGenericSignature(), SubstFTy->getExtInfo(),
848+
SubstFTy->getCoroutineKind(), SubstFTy->getCalleeConvention(),
852849
SpecializedParams, SpecializedYields, SpecializedResults,
853-
SubstFTy->getOptionalErrorResult(),
854-
SubstitutionMap(), false, M.getASTContext(),
855-
SubstFTy->getWitnessMethodConformanceOrNone());
850+
SubstFTy->getOptionalErrorResult(), SubstitutionMap(), false,
851+
M.getASTContext(), SubstFTy->getWitnessMethodConformanceOrInvalid());
856852
}
857853

858854
/// Create a new generic signature from an existing one by adding

lib/Serialization/Serialization.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3981,7 +3981,7 @@ class Serializer::TypeSerializer : public TypeVisitor<TypeSerializer> {
39813981
fnTy->getNumYields(), fnTy->getNumResults(),
39823982
S.addGenericSignatureRef(sig), variableData);
39833983

3984-
auto conformance = fnTy->getWitnessMethodConformanceOrNone();
3984+
auto conformance = fnTy->getWitnessMethodConformanceOrInvalid();
39853985
if (!conformance.isInvalid())
39863986
S.writeConformance(conformance, S.DeclTypeAbbrCodes);
39873987
}

0 commit comments

Comments
 (0)