Skip to content

Commit 79d4260

Browse files
committed
SIL: Remove the incorrect old getTypeLinkage()
1 parent 29fdb62 commit 79d4260

File tree

6 files changed

+5
-22
lines changed

6 files changed

+5
-22
lines changed

include/swift/SIL/FormalLinkage.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ enum class FormalLinkage {
4545

4646
FormalLinkage getDeclLinkage(const ValueDecl *decl);
4747
FormalLinkage getTypeLinkage(CanType formalType);
48-
FormalLinkage getTypeLinkage_correct(CanType formalType);
4948
FormalLinkage getGenericSignatureLinkage(CanGenericSignature signature);
5049
SILLinkage getSILLinkage(FormalLinkage linkage,
5150
ForDefinition_t forDefinition);

lib/IRGen/GenMeta.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6967,7 +6967,7 @@ llvm::GlobalValue *irgen::emitAsyncFunctionPointer(IRGenModule &IGM,
69676967

69686968
static FormalLinkage getExistentialShapeLinkage(CanGenericSignature genSig,
69696969
CanType shapeType) {
6970-
auto typeLinkage = getTypeLinkage_correct(shapeType);
6970+
auto typeLinkage = getTypeLinkage(shapeType);
69716971
if (typeLinkage == FormalLinkage::Private)
69726972
return FormalLinkage::Private;
69736973

lib/IRGen/Outlining.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,6 @@ static bool needsSpecialOwnershipHandling(SILType t) {
208208
return ref->getOwnership() != ReferenceOwnership::Strong;
209209
}
210210

211-
bool isTypeMetadataForLayoutAccessible(SILModule &M, SILType type);
212-
213211
static bool canUseValueWitnessForValueOp(IRGenModule &IGM, SILType T) {
214212
if (!IGM.getSILModule().isTypeMetadataForLayoutAccessible(T))
215213
return false;

lib/SIL/IR/SIL.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ FormalLinkage swift::getGenericSignatureLinkage(CanGenericSignature sig) {
172172
case RequirementKind::Conformance:
173173
case RequirementKind::SameType:
174174
case RequirementKind::Superclass:
175-
switch (getTypeLinkage_correct(CanType(req.getSecondType()))) {
175+
switch (getTypeLinkage(CanType(req.getSecondType()))) {
176176
case FormalLinkage::PublicUnique:
177177
case FormalLinkage::PublicNonUnique:
178178
continue;
@@ -189,19 +189,6 @@ FormalLinkage swift::getGenericSignatureLinkage(CanGenericSignature sig) {
189189
return linkage;
190190
}
191191

192-
/// Return the formal linkage of the given formal type.
193-
///
194-
/// Note that this function is buggy and generally should not be
195-
/// used in new code; we should migrate all callers to
196-
/// getTypeLinkage_correct and then consolidate them.
197-
FormalLinkage swift::getTypeLinkage(CanType t) {
198-
assert(t->isLegalFormalType());
199-
// Due to a bug, this always returns PublicUnique.
200-
// It's a bit late in the 5.7 timeline to be changing that, but
201-
// we can optimize it!
202-
return FormalLinkage::PublicUnique;
203-
}
204-
205192
/// Return the formal linkage of the given formal type.
206193
/// This in the appropriate linkage for a lazily-emitted entity
207194
/// derived from the type.
@@ -211,7 +198,7 @@ FormalLinkage swift::getTypeLinkage(CanType t) {
211198
/// uniquely-emitted nominal type, the formal linkage of that
212199
/// type may differ from the formal linkage of the underlying
213200
/// type declaration.
214-
FormalLinkage swift::getTypeLinkage_correct(CanType t) {
201+
FormalLinkage swift::getTypeLinkage(CanType t) {
215202
assert(t->isLegalFormalType());
216203

217204
class Walker : public TypeWalker {
@@ -265,7 +252,6 @@ static bool isTypeMetadataForLayoutAccessible(SILModule &M, SILType type) {
265252

266253
// Otherwise, check that we can fetch the type metadata.
267254
return M.isTypeMetadataAccessible(type.getASTType());
268-
269255
}
270256

271257
/// Can we perform value operations on the given type? We have no way

lib/SILGen/SILGenThunk.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ getOrCreateReabstractionThunk(CanSILFunctionType thunkType,
580580
auto serializable = IsSerialized;
581581
if (fromGlobalActorBound) {
582582
auto globalActorLinkage = getTypeLinkage(fromGlobalActorBound);
583-
serializable = globalActorLinkage >= FormalLinkage::PublicNonUnique
583+
serializable = globalActorLinkage <= FormalLinkage::PublicNonUnique
584584
? IsSerialized : IsNotSerialized;
585585
}
586586

test/SILGen/hop_to_executor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ func testGlobalActorClosure() {
379379
let pga: @PrivateGlobalActor () -> () = { @PrivateGlobalActor in print(5) }
380380
acceptAsyncClosure(pga)
381381

382-
// CHECK-LABEL: sil shared [transparent] [reabstraction_thunk] [ossa] @$sIeg_IegH_TR4test17PublicGlobalActorVTU
382+
// CHECK-LABEL: sil shared [transparent] [serialized] [reabstraction_thunk] [ossa] @$sIeg_IegH_TR4test17PublicGlobalActorVTU
383383
// CHECK: hop_to_executor {{%.*}} : $MyPublicActor
384384
// CHECK: apply %0()
385385
let pbga: @PublicGlobalActor () -> () = { @PublicGlobalActor in print(5) }

0 commit comments

Comments
 (0)