Skip to content

Commit d2a8128

Browse files
committed
[SIL] Expose indirect error type on convention.
1 parent 30d779e commit d2a8128

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

include/swift/SIL/SILFunctionConventions.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,24 @@ class SILFunctionConventions {
242242
return 0;
243243
}
244244

245+
std::optional<SILResultInfo> getIndirectErrorResult() const {
246+
if (!silConv.loweredAddresses)
247+
return std::nullopt;
248+
auto info = funcTy->getOptionalErrorResult();
249+
if (!info)
250+
return std::nullopt;
251+
if (info->getConvention() != ResultConvention::Indirect)
252+
return std::nullopt;
253+
return info;
254+
}
255+
256+
SILType getIndirectErrorResultType(TypeExpansionContext context) const {
257+
auto result = getIndirectErrorResult();
258+
if (!result)
259+
return SILType();
260+
return getSILType(*result, context);
261+
}
262+
245263
bool isArgumentIndexOfIndirectErrorResult(unsigned idx) {
246264
unsigned indirectResults = getNumIndirectSILResults();
247265
return idx >= indirectResults &&

0 commit comments

Comments
 (0)