Skip to content

Commit 470fa2f

Browse files
committed
Remove resultDependsOn/resultDependsOnSelf
1 parent d1343dc commit 470fa2f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+49
-442
lines changed

SwiftCompilerSources/Sources/SIL/Argument.swift

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ final public class FunctionArgument : Argument {
6060
return index < parentFunction.numIndirectResultArguments
6161
}
6262

63-
public var hasResultDependsOn : Bool {
64-
return bridged.hasResultDependsOn()
65-
}
66-
6763
/// If the function's result depends on this argument, return the
6864
/// kind of dependence.
6965
public var resultDependence: LifetimeDependenceConvention? {

SwiftCompilerSources/Sources/SIL/Function.swift

-4
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,6 @@ extension Function {
290290
public var hasResultDependence: Bool {
291291
convention.resultDependencies != nil
292292
}
293-
294-
public var hasResultDependsOnSelf: Bool {
295-
return bridged.hasResultDependsOnSelf()
296-
}
297293
}
298294

299295
public struct ArgumentTypeArray : RandomAccessCollection, FormattedLikeArray {

include/swift/AST/ASTBridging.h

-1
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,6 @@ enum ENUM_EXTENSIBILITY_ATTR(open) BridgedAttributedTypeSpecifier : size_t {
15501550
BridgedAttributedTypeSpecifierLegacyOwned,
15511551
BridgedAttributedTypeSpecifierConst,
15521552
BridgedAttributedTypeSpecifierIsolated,
1553-
BridgedAttributedTypeSpecifierResultDependsOn,
15541553
BridgedAttributedTypeSpecifierTransferring,
15551554
BridgedAttributedTypeSpecifierSending,
15561555
};

include/swift/AST/Decl.h

-17
Original file line numberDiff line numberDiff line change
@@ -6616,8 +6616,6 @@ class ParamDecl : public VarDecl {
66166616

66176617
/// Whether or not this parameter is '_const'.
66186618
IsCompileTimeConst = 1 << 1,
6619-
6620-
HasResultDependsOn = 1 << 2,
66216619
};
66226620

66236621
llvm::PointerIntPair<Identifier, 3, OptionSet<ArgumentNameFlags>>
@@ -6656,9 +6654,6 @@ class ParamDecl : public VarDecl {
66566654
/// Whether or not this parameter is 'isolated'.
66576655
IsIsolated = 1 << 2,
66586656

6659-
/// Whether or not this paramater is '_resultDependsOn'
6660-
IsResultDependsOn = 1 << 3,
6661-
66626657
/// Whether or not this parameter is 'sending'.
66636658
IsSending = 1 << 4,
66646659
};
@@ -6961,18 +6956,6 @@ class ParamDecl : public VarDecl {
69616956
ArgumentNameAndFlags.setInt(flags);
69626957
}
69636958

6964-
bool hasResultDependsOn() const {
6965-
return ArgumentNameAndFlags.getInt().contains(
6966-
ArgumentNameFlags::HasResultDependsOn);
6967-
}
6968-
6969-
void setResultDependsOn(bool value = true) {
6970-
auto flags = ArgumentNameAndFlags.getInt();
6971-
flags = value ? flags | ArgumentNameFlags::HasResultDependsOn
6972-
: flags - ArgumentNameFlags::HasResultDependsOn;
6973-
ArgumentNameAndFlags.setInt(flags);
6974-
}
6975-
69766959
/// Does this parameter reject temporary pointer conversions?
69776960
bool isNonEphemeral() const;
69786961

include/swift/AST/DeclAttr.def

-3
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,6 @@ DECL_ATTR(storageRestrictions, StorageRestrictions,
468468
CONTEXTUAL_SIMPLE_DECL_ATTR(actor, Actor,
469469
DeclModifier | OnClass | ConcurrencyOnly | ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
470470
102)
471-
CONTEXTUAL_SIMPLE_DECL_ATTR(_resultDependsOnSelf, ResultDependsOnSelf,
472-
OnFunc | DeclModifier | UserInaccessible | ABIBreakingToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove,
473-
150)
474471
SIMPLE_DECL_ATTR(_staticExclusiveOnly, StaticExclusiveOnly,
475472
OnStruct | UserInaccessible | ABIStableToAdd | ABIStableToRemove | APIBreakingToAdd | APIStableToRemove,
476473
151)

include/swift/AST/DiagnosticsSema.def

-7
Original file line numberDiff line numberDiff line change
@@ -7931,13 +7931,6 @@ ERROR(referencebindings_binding_must_have_initial_value,none,
79317931
ERROR(referencebindings_binding_must_be_to_lvalue,none,
79327932
"%0 bindings must be bound to an lvalue", (StringRef))
79337933

7934-
//------------------------------------------------------------------------------
7935-
// MARK: resultDependsOn Errors
7936-
//------------------------------------------------------------------------------
7937-
7938-
ERROR(result_depends_on_no_result,none,
7939-
"Incorrect use of %0 with no result", (StringRef))
7940-
79417934
//------------------------------------------------------------------------------
79427935
// MARK: Pack Iteration Diagnostics
79437936
//------------------------------------------------------------------------------

include/swift/AST/TypeRepr.h

-17
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,6 @@ class SpecifierTypeRepr : public TypeRepr {
11141114
return T->getKind() == TypeReprKind::Ownership ||
11151115
T->getKind() == TypeReprKind::Isolated ||
11161116
T->getKind() == TypeReprKind::CompileTimeConst ||
1117-
T->getKind() == TypeReprKind::ResultDependsOn ||
11181117
T->getKind() == TypeReprKind::LifetimeDependentReturn ||
11191118
T->getKind() == TypeReprKind::Transferring ||
11201119
T->getKind() == TypeReprKind::Sending;
@@ -1188,21 +1187,6 @@ class CompileTimeConstTypeRepr : public SpecifierTypeRepr {
11881187
static bool classof(const CompileTimeConstTypeRepr *T) { return true; }
11891188
};
11901189

1191-
/// A lifetime dependent type.
1192-
/// \code
1193-
/// x : _resultDependsOn Int
1194-
/// \endcode
1195-
class ResultDependsOnTypeRepr : public SpecifierTypeRepr {
1196-
public:
1197-
ResultDependsOnTypeRepr(TypeRepr *Base, SourceLoc InOutLoc)
1198-
: SpecifierTypeRepr(TypeReprKind::ResultDependsOn, Base, InOutLoc) {}
1199-
1200-
static bool classof(const TypeRepr *T) {
1201-
return T->getKind() == TypeReprKind::ResultDependsOn;
1202-
}
1203-
static bool classof(const ResultDependsOnTypeRepr *T) { return true; }
1204-
};
1205-
12061190
/// A transferring type.
12071191
/// \code
12081192
/// x : transferring Int
@@ -1637,7 +1621,6 @@ inline bool TypeRepr::isSimple() const {
16371621
case TypeReprKind::Sending:
16381622
case TypeReprKind::Placeholder:
16391623
case TypeReprKind::CompileTimeConst:
1640-
case TypeReprKind::ResultDependsOn:
16411624
case TypeReprKind::LifetimeDependentReturn:
16421625
return true;
16431626
}

include/swift/AST/TypeReprNodes.def

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ ABSTRACT_TYPEREPR(Specifier, TypeRepr)
7070
SPECIFIER_TYPEREPR(Ownership, SpecifierTypeRepr)
7171
SPECIFIER_TYPEREPR(Isolated, SpecifierTypeRepr)
7272
SPECIFIER_TYPEREPR(CompileTimeConst, SpecifierTypeRepr)
73-
SPECIFIER_TYPEREPR(ResultDependsOn, SpecifierTypeRepr)
7473
SPECIFIER_TYPEREPR(Transferring, SpecifierTypeRepr)
7574
SPECIFIER_TYPEREPR(Sending, SpecifierTypeRepr)
7675
TYPEREPR(Fixed, TypeRepr)

include/swift/AST/Types.h

+7-13
Original file line numberDiff line numberDiff line change
@@ -2226,9 +2226,8 @@ class ParameterTypeFlags {
22262226
NoDerivative = 1 << 6,
22272227
Isolated = 1 << 7,
22282228
CompileTimeConst = 1 << 8,
2229-
ResultDependsOn = 1 << 9,
2230-
Sending = 1 << 10,
2231-
NumBits = 11
2229+
Sending = 1 << 9,
2230+
NumBits = 10
22322231
};
22332232
OptionSet<ParameterFlags> value;
22342233
static_assert(NumBits <= 8*sizeof(OptionSet<ParameterFlags>), "overflowed");
@@ -2243,22 +2242,20 @@ class ParameterTypeFlags {
22432242

22442243
ParameterTypeFlags(bool variadic, bool autoclosure, bool nonEphemeral,
22452244
ParamSpecifier specifier, bool isolated, bool noDerivative,
2246-
bool compileTimeConst, bool hasResultDependsOn,
2247-
bool isSending)
2245+
bool compileTimeConst, bool isSending)
22482246
: value((variadic ? Variadic : 0) | (autoclosure ? AutoClosure : 0) |
22492247
(nonEphemeral ? NonEphemeral : 0) |
22502248
uint8_t(specifier) << SpecifierShift | (isolated ? Isolated : 0) |
22512249
(noDerivative ? NoDerivative : 0) |
22522250
(compileTimeConst ? CompileTimeConst : 0) |
2253-
(hasResultDependsOn ? ResultDependsOn : 0) |
22542251
(isSending ? Sending : 0)) {}
22552252

22562253
/// Create one from what's present in the parameter type
22572254
inline static ParameterTypeFlags
22582255
fromParameterType(Type paramTy, bool isVariadic, bool isAutoClosure,
22592256
bool isNonEphemeral, ParamSpecifier ownership,
22602257
bool isolated, bool isNoDerivative, bool compileTimeConst,
2261-
bool hasResultDependsOn, bool isSending);
2258+
bool isSending);
22622259

22632260
bool isNone() const { return !value; }
22642261
bool isVariadic() const { return value.contains(Variadic); }
@@ -2270,7 +2267,6 @@ class ParameterTypeFlags {
22702267
bool isIsolated() const { return value.contains(Isolated); }
22712268
bool isCompileTimeConst() const { return value.contains(CompileTimeConst); }
22722269
bool isNoDerivative() const { return value.contains(NoDerivative); }
2273-
bool hasResultDependsOn() const { return value.contains(ResultDependsOn); }
22742270
bool isSending() const { return value.contains(Sending); }
22752271

22762272
/// Get the spelling of the parameter specifier used on the parameter.
@@ -2433,7 +2429,6 @@ class YieldTypeFlags {
24332429
/*nonEphemeral*/ false, getOwnershipSpecifier(),
24342430
/*isolated*/ false, /*noDerivative*/ false,
24352431
/*compileTimeConst*/ false,
2436-
/*hasResultDependsOn*/ false,
24372432
/*is transferring*/ false);
24382433
}
24392434

@@ -7771,7 +7766,7 @@ inline TupleTypeElt TupleTypeElt::getWithType(Type T) const {
77717766
inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
77727767
Type paramTy, bool isVariadic, bool isAutoClosure, bool isNonEphemeral,
77737768
ParamSpecifier ownership, bool isolated, bool isNoDerivative,
7774-
bool compileTimeConst, bool hasResultDependsOn, bool isSending) {
7769+
bool compileTimeConst, bool isSending) {
77757770
// FIXME(Remove InOut): The last caller that needs this is argument
77767771
// decomposition. Start by enabling the assertion there and fixing up those
77777772
// callers, then remove this, then remove
@@ -7781,9 +7776,8 @@ inline ParameterTypeFlags ParameterTypeFlags::fromParameterType(
77817776
ownership == ParamSpecifier::InOut);
77827777
ownership = ParamSpecifier::InOut;
77837778
}
7784-
return {isVariadic, isAutoClosure, isNonEphemeral,
7785-
ownership, isolated, isNoDerivative,
7786-
compileTimeConst, hasResultDependsOn, isSending};
7779+
return {isVariadic, isAutoClosure, isNonEphemeral, ownership,
7780+
isolated, isNoDerivative, compileTimeConst, isSending};
77877781
}
77887782

77897783
inline const Type *BoundGenericType::getTrailingObjectsPointer() const {

include/swift/Parse/Parser.h

+1-9
Original file line numberDiff line numberDiff line change
@@ -1200,18 +1200,14 @@ class Parser {
12001200
Tok.isContextualKeyword("isolated") ||
12011201
Tok.isContextualKeyword("_const"))
12021202
return true;
1203-
if (Context.LangOpts.hasFeature(Feature::NonescapableTypes) &&
1204-
Tok.isContextualKeyword("_resultDependsOn"))
1205-
return true;
12061203
if (Context.LangOpts.hasFeature(Feature::TransferringArgsAndResults) &&
12071204
Tok.isContextualKeyword("transferring"))
12081205
return true;
12091206
if (Context.LangOpts.hasFeature(Feature::SendingArgsAndResults) &&
12101207
Tok.isContextualKeyword("sending"))
12111208
return true;
12121209
if (Context.LangOpts.hasFeature(Feature::NonescapableTypes) &&
1213-
(Tok.isContextualKeyword("_resultDependsOn") ||
1214-
isLifetimeDependenceToken()))
1210+
isLifetimeDependenceToken())
12151211
return true;
12161212
return false;
12171213
}
@@ -1257,7 +1253,6 @@ class Parser {
12571253
SourceLoc SpecifierLoc;
12581254
SourceLoc IsolatedLoc;
12591255
SourceLoc ConstLoc;
1260-
SourceLoc ResultDependsOnLoc;
12611256
SourceLoc TransferringLoc;
12621257
SourceLoc SendingLoc;
12631258
SmallVector<TypeOrCustomAttr> Attributes;
@@ -1571,9 +1566,6 @@ class Parser {
15711566
/// The location of the '_const' keyword, if present.
15721567
SourceLoc CompileConstLoc;
15731568

1574-
/// The location of the '_resultDependsOn' keyword, if present.
1575-
SourceLoc ResultDependsOnLoc;
1576-
15771569
/// The location of the 'transferring' keyword if present.
15781570
SourceLoc TransferringLoc;
15791571

include/swift/SIL/SILArgument.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -366,15 +366,13 @@ class SILFunctionArgument : public SILArgument {
366366
ValueOwnershipKind ownershipKind, const ValueDecl *decl = nullptr,
367367
bool isNoImplicitCopy = false,
368368
LifetimeAnnotation lifetimeAnnotation = LifetimeAnnotation::None,
369-
bool isCapture = false, bool isParameterPack = false,
370-
bool hasResultDependsOn = false)
369+
bool isCapture = false, bool isParameterPack = false)
371370
: SILArgument(ValueKind::SILFunctionArgument, parentBlock, type,
372371
ownershipKind, decl) {
373372
sharedUInt32().SILFunctionArgument.noImplicitCopy = isNoImplicitCopy;
374373
sharedUInt32().SILFunctionArgument.lifetimeAnnotation = lifetimeAnnotation;
375374
sharedUInt32().SILFunctionArgument.closureCapture = isCapture;
376375
sharedUInt32().SILFunctionArgument.parameterPack = isParameterPack;
377-
sharedUInt32().SILFunctionArgument.hasResultDependsOn = hasResultDependsOn;
378376
}
379377

380378
// A special constructor, only intended for use in
@@ -426,14 +424,6 @@ class SILFunctionArgument : public SILArgument {
426424
sharedUInt32().SILFunctionArgument.lifetimeAnnotation = newValue;
427425
}
428426

429-
bool hasResultDependsOn() const {
430-
return sharedUInt32().SILFunctionArgument.hasResultDependsOn;
431-
}
432-
433-
void setHasResultDependsOn(bool flag = true) {
434-
sharedUInt32().SILFunctionArgument.hasResultDependsOn = flag;
435-
}
436-
437427
bool isSending() const {
438428
return getKnownParameterInfo().hasOption(SILParameterInfo::Sending);
439429
}

include/swift/SIL/SILBridging.h

-2
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,6 @@ struct BridgedFunction {
622622
BRIDGED_INLINE bool isGeneric() const;
623623
BRIDGED_INLINE bool hasSemanticsAttr(BridgedStringRef attrName) const;
624624
BRIDGED_INLINE bool hasUnsafeNonEscapableResult() const;
625-
BRIDGED_INLINE bool hasResultDependsOnSelf() const;
626625
bool mayBindDynamicSelf() const;
627626
BRIDGED_INLINE EffectsKind getEffectAttribute() const;
628627
BRIDGED_INLINE PerformanceConstraints getPerformanceConstraints() const;
@@ -1026,7 +1025,6 @@ struct BridgedArgument {
10261025
BRIDGED_INLINE swift::SILArgument * _Nonnull getArgument() const;
10271026
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedBasicBlock getParent() const;
10281027
BRIDGED_INLINE bool isReborrow() const;
1029-
BRIDGED_INLINE bool hasResultDependsOn() const;
10301028
SWIFT_IMPORT_UNSAFE BRIDGED_INLINE BridgedNullableVarDecl getVarDecl() const;
10311029
BRIDGED_INLINE void copyFlags(BridgedArgument fromArgument) const;
10321030
};

include/swift/SIL/SILBridgingImpl.h

-9
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,6 @@ BridgedBasicBlock BridgedArgument::getParent() const {
520520
return {getArgument()->getParent()};
521521
}
522522

523-
bool BridgedArgument::hasResultDependsOn() const {
524-
auto *fArg = static_cast<swift::SILFunctionArgument*>(getArgument());
525-
return fArg->hasResultDependsOn();
526-
}
527-
528523
bool BridgedArgument::isReborrow() const { return getArgument()->isReborrow(); }
529524

530525
BridgedNullableVarDecl BridgedArgument::getVarDecl() const {
@@ -692,10 +687,6 @@ bool BridgedFunction::hasUnsafeNonEscapableResult() const {
692687
return getFunction()->hasUnsafeNonEscapableResult();
693688
}
694689

695-
bool BridgedFunction::hasResultDependsOnSelf() const {
696-
return getFunction()->hasResultDependsOnSelf();
697-
}
698-
699690
BridgedFunction::EffectsKind BridgedFunction::getEffectAttribute() const {
700691
return (EffectsKind)getFunction()->getEffectsKind();
701692
}

include/swift/SIL/SILFunction.h

-7
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,6 @@ class SILFunction
464464
/// lifetime-dependence on an argument.
465465
unsigned HasUnsafeNonEscapableResult : 1;
466466

467-
unsigned HasResultDependsOnSelf : 1;
468-
469467
/// True, if this function or a caller (transitively) has a performance
470468
/// constraint.
471469
/// If true, optimizations must not introduce new runtime calls or metadata
@@ -758,11 +756,6 @@ class SILFunction
758756
HasUnsafeNonEscapableResult = value;
759757
}
760758

761-
bool hasResultDependsOnSelf() const { return HasResultDependsOnSelf; }
762-
763-
void setHasResultDependsOnSelf(bool flag = true) {
764-
HasResultDependsOnSelf = flag;
765-
}
766759
/// Returns true if this is a reabstraction thunk of escaping function type
767760
/// whose single argument is a potentially non-escaping closure. i.e. the
768761
/// thunks' function argument may itself have @inout_aliasable parameters.

include/swift/SIL/SILNode.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ class alignas(8) SILNode :
311311
SHARED_FIELD(PointerToAddressInst, uint32_t alignment);
312312
SHARED_FIELD(SILFunctionArgument, uint32_t noImplicitCopy : 1,
313313
lifetimeAnnotation : 2, closureCapture : 1,
314-
parameterPack : 1, hasResultDependsOn : 1);
314+
parameterPack : 1);
315315

316316
// Do not use `_sharedUInt32_private` outside of SILNode.
317317
} _sharedUInt32_private;

lib/AST/ASTBridging.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -2236,9 +2236,6 @@ BridgedSpecifierTypeRepr BridgedSpecifierTypeRepr_createParsed(
22362236
case BridgedAttributedTypeSpecifierIsolated: {
22372237
return new (context) IsolatedTypeRepr(baseType, loc);
22382238
}
2239-
case BridgedAttributedTypeSpecifierResultDependsOn: {
2240-
return new (context) ResultDependsOnTypeRepr(baseType, loc);
2241-
}
22422239
}
22432240
}
22442241

lib/AST/ASTDumper.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -3462,13 +3462,6 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr, void, StringRef>,
34623462
printFoot();
34633463
}
34643464

3465-
void visitResultDependsOnTypeRepr(ResultDependsOnTypeRepr *T,
3466-
StringRef label) {
3467-
printCommon("_resultDependsOn", label);
3468-
printRec(T->getBase());
3469-
printFoot();
3470-
}
3471-
34723465
void visitOptionalTypeRepr(OptionalTypeRepr *T, StringRef label) {
34733466
printCommon("type_optional", label);
34743467
printRec(T->getBase());

lib/AST/ASTPrinter.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -3783,9 +3783,6 @@ static void printParameterFlags(ASTPrinter &printer,
37833783
printer.printKeyword("isolated", options, " ");
37843784
}
37853785

3786-
if (flags.hasResultDependsOn())
3787-
printer.printKeyword("_resultDependsOn", options, " ");
3788-
37893786
if (!options.excludeAttrKind(TypeAttrKind::Escaping) && escaping)
37903787
printer.printKeyword("@escaping", options, " ");
37913788

lib/AST/ASTWalker.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -2348,10 +2348,6 @@ bool Traversal::visitCompileTimeConstTypeRepr(CompileTimeConstTypeRepr *T) {
23482348
return doIt(T->getBase());
23492349
}
23502350

2351-
bool Traversal::visitResultDependsOnTypeRepr(ResultDependsOnTypeRepr *T) {
2352-
return doIt(T->getBase());
2353-
}
2354-
23552351
bool Traversal::visitOpaqueReturnTypeRepr(OpaqueReturnTypeRepr *T) {
23562352
return doIt(T->getConstraint());
23572353
}

0 commit comments

Comments
 (0)