Skip to content

Commit 173b698

Browse files
committed
Swift SIL: add ApplySite.numIndirectResultArguments
1 parent 60609eb commit 173b698

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

SwiftCompilerSources/Sources/SIL/ApplySite.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,11 @@ extension FullApplySite {
133133
}
134134
return nil
135135
}
136+
137+
/// The number of indirect out arguments.
138+
///
139+
/// 0 if the callee has a direct or no return value and 1, if it has an indirect return value.
140+
public var numIndirectResultArguments: Int {
141+
return FullApplySite_numIndirectResultArguments(bridged)
142+
}
136143
}

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ swift::SubstitutionMap ApplySite_getSubstitutionMap(BridgedInstruction inst);
428428
BridgedArgumentConvention
429429
ApplySite_getArgumentConvention(BridgedInstruction inst, SwiftInt calleeArgIdx);
430430
SwiftInt ApplySite_getNumArguments(BridgedInstruction inst);
431+
SwiftInt FullApplySite_numIndirectResultArguments(BridgedInstruction inst);
431432

432433
BridgedInstruction SILBuilder_createBuiltinBinaryFunction(
433434
BridgedBuilder builder, llvm::StringRef name,

lib/SIL/Utils/SILBridging.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,12 @@ SwiftInt ApplySite_getNumArguments(BridgedInstruction inst) {
10201020
return as.getNumArguments();
10211021
}
10221022

1023+
SwiftInt FullApplySite_numIndirectResultArguments(BridgedInstruction inst) {
1024+
auto fas = FullApplySite(castToInst(inst));
1025+
return fas.getNumIndirectSILResults();
1026+
1027+
}
1028+
10231029
//===----------------------------------------------------------------------===//
10241030
// SILBuilder
10251031
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)