Skip to content

Commit 6665cd5

Browse files
committed
[NFC] hasGuaranteedAddressResults -> hasGuaranteedAddressResult and hasGuaranteedResults -> hasGuaranteedResult
1 parent 29f5dad commit 6665cd5

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

include/swift/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5396,7 +5396,7 @@ class SILFunctionType final
53965396
return hasErrorResult() && getErrorResult().isFormalIndirect();
53975397
}
53985398

5399-
bool hasGuaranteedAddressResults() const {
5399+
bool hasGuaranteedAddressResult() const {
54005400
for (auto &result : getResults()) {
54015401
if (result.isGuaranteedAddressResult()) {
54025402
return true;

include/swift/SIL/MemAccessUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ inline bool isGuaranteedAddressReturn(SILValue value) {
169169
if (!defInst) {
170170
return false;
171171
}
172-
return defInst->getSubstCalleeConv().hasGuaranteedAddressResults();
172+
return defInst->getSubstCalleeConv().hasGuaranteedAddressResult();
173173
}
174174

175175
/// Return the source address after stripping as many access projections as

include/swift/SIL/SILFunctionConventions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class SILFunctionConventions {
298298
IndirectSILResultFilter(silConv.loweredAddresses));
299299
}
300300

301-
bool hasGuaranteedResults() const {
301+
bool hasGuaranteedResult() const {
302302
for (auto result : funcTy->getResults()) {
303303
if (result.getConvention() == ResultConvention::Guaranteed) {
304304
return true;
@@ -307,7 +307,7 @@ class SILFunctionConventions {
307307
return false;
308308
}
309309

310-
bool hasGuaranteedAddressResults() const {
310+
bool hasGuaranteedAddressResult() const {
311311
for (auto result : funcTy->getResults()) {
312312
if (result.getConvention() == ResultConvention::GuaranteedAddress) {
313313
return true;

include/swift/SIL/SILInstruction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3150,7 +3150,7 @@ class ApplyInst final
31503150

31513151
public:
31523152
bool hasGuaranteedResult() const {
3153-
return getSubstCalleeConv().hasGuaranteedResults();
3153+
return getSubstCalleeConv().hasGuaranteedResult();
31543154
}
31553155
};
31563156

lib/SIL/IR/SILFunctionType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ SILFunctionType::getDirectFormalResultsType(SILModule &M,
180180
TypeExpansionContext context) {
181181
CanType type;
182182

183-
if (hasGuaranteedAddressResults()) {
183+
if (hasGuaranteedAddressResult()) {
184184
assert(getNumDirectFormalResults() == 1);
185185
return SILType::getPrimitiveAddressType(
186186
getSingleDirectFormalResult().getReturnValueType(M, this, context));

lib/SILGen/SILGenEpilog.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@ void SILGenFunction::prepareEpilog(
3333
// emits unreachable if there is no source level return.
3434
NeedsReturn = !(*directResultType)->isEqual(TupleType::getEmpty(getASTContext()));
3535
if (NeedsReturn) {
36-
if (fnConv.hasGuaranteedAddressResults() ||
37-
fnConv.hasGuaranteedResults()) {
36+
if (fnConv.hasGuaranteedAddressResult() || fnConv.hasGuaranteedResult()) {
3837
// Do not explode tuples for borrow/mutate accessors
3938
SILType resultType =
4039
F.getLoweredType(F.mapTypeIntoContext(*directResultType));
41-
epilogBB->createPhiArgument(resultType, fnConv.hasGuaranteedResults()
40+
epilogBB->createPhiArgument(resultType, fnConv.hasGuaranteedResult()
4241
? OwnershipKind::Guaranteed
4342
: OwnershipKind::None);
4443
} else {
@@ -64,9 +63,9 @@ void SILGenFunction::prepareEpilog(
6463
worklist.push_back(ty.getTupleElementType(index));
6564
}
6665
} else {
67-
if (fnConv.hasGuaranteedResults()) {
66+
if (fnConv.hasGuaranteedResult()) {
6867
epilogBB->createPhiArgument(ty, OwnershipKind::Guaranteed);
69-
} else if (fnConv.hasGuaranteedAddressResults()) {
68+
} else if (fnConv.hasGuaranteedAddressResult()) {
7069
epilogBB->createPhiArgument(ty, OwnershipKind::None);
7170
} else {
7271
epilogBB->createPhiArgument(ty, OwnershipKind::Owned);

lib/SILGen/SILGenStmt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,8 @@ void SILGenFunction::emitReturnExpr(SILLocation branchLoc,
735735
for (auto cleanup : resultCleanups) {
736736
Cleanups.forwardCleanup(cleanup);
737737
}
738-
} else if (F.getConventions().hasGuaranteedResults() ||
739-
F.getConventions().hasGuaranteedAddressResults()) {
738+
} else if (F.getConventions().hasGuaranteedResult() ||
739+
F.getConventions().hasGuaranteedAddressResult()) {
740740
// If the return expression is a literal, emit as a regular return
741741
// expression/
742742
if (isa<LiteralExpr>(ret)) {
@@ -769,7 +769,7 @@ void SILGenFunction::emitReturnExpr(SILLocation branchLoc,
769769
// Emit return value at +0.
770770
LValueOptions options;
771771
auto lvalue = emitLValue(ret,
772-
F.getConventions().hasGuaranteedResults()
772+
F.getConventions().hasGuaranteedResult()
773773
? SGFAccessKind::BorrowedObjectRead
774774
: SGFAccessKind::BorrowedAddressRead,
775775
options.withBorrow(true));
@@ -785,7 +785,7 @@ void SILGenFunction::emitReturnExpr(SILLocation branchLoc,
785785
// Address type phis are banned in SIL.
786786
// For now diagnose multiple return statements in such cases.
787787
// TODO: Support multiple epilog blocks in SILGen and SILOptimizer.
788-
if (F.getConventions().hasGuaranteedAddressResults() &&
788+
if (F.getConventions().hasGuaranteedAddressResult() &&
789789
!ReturnDest.getBlock()->getPredecessorBlocks().empty()) {
790790
diagnose(getASTContext(), ret->getStartLoc(),
791791
diag::invalid_multiple_return_borrow_accessor);

lib/SILOptimizer/Mandatory/MoveOnlyAddressCheckerUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ addressBeginsInitialized(MarkUnresolvedNonCopyableValueInst *address) {
11151115

11161116
if (auto *applyInst = dyn_cast_or_null<ApplyInst>(
11171117
stripAccessMarkers(operand)->getDefiningInstruction())) {
1118-
if (applyInst->getSubstCalleeConv().hasGuaranteedAddressResults()) {
1118+
if (applyInst->getSubstCalleeConv().hasGuaranteedAddressResult()) {
11191119
LLVM_DEBUG(llvm::dbgs() << "Adding apply as init!\n");
11201120
return true;
11211121
}

lib/SILOptimizer/Transforms/GenericSpecializer.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ bool swift::specializeAppliesInFunction(SILFunction &F,
112112
// temporary stack location and returns a projection from the
113113
// store_borrow. This does not work for borrow accessors that return the
114114
// projection from within the store_borrow scope.
115-
if (F.hasOwnership() && Callee->getConventions().hasGuaranteedAddressResults()) {
115+
if (F.hasOwnership() &&
116+
Callee->getConventions().hasGuaranteedAddressResult()) {
116117
continue;
117118
}
118119

0 commit comments

Comments
 (0)