Skip to content

Commit b0cb516

Browse files
committed
[gardening] Add a helper to SILFunctionConventions to retrieve if a function has a noreturn result.
Sometimes one just has a SILFunctionConvention instead of the underlying SILFunctionType (that the SILFunctionConvention contains). This just shims in that API onto the composition type.
1 parent 241c5d9 commit b0cb516

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/swift/SIL/SILFunctionConventions.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ class SILFunctionConventions {
396396
/// Return the SIL type of the apply/entry argument at the given index.
397397
SILType getSILArgumentType(unsigned index,
398398
TypeExpansionContext context) const;
399+
400+
/// Returns true if this function does not return to the caller.
401+
bool isNoReturn(TypeExpansionContext context) const;
399402
};
400403

401404
struct SILFunctionConventions::SILResultTypeFunc {
@@ -464,6 +467,11 @@ SILFunctionConventions::getSILArgumentType(unsigned index,
464467
funcTy->getParameters()[index - getNumIndirectSILResults()], context);
465468
}
466469

470+
inline bool
471+
SILFunctionConventions::isNoReturn(TypeExpansionContext context) const {
472+
return funcTy->isNoReturnFunction(silConv.getModule(), context);
473+
}
474+
467475
inline SILFunctionConventions
468476
SILModuleConventions::getFunctionConventions(CanSILFunctionType funcTy) {
469477
return SILFunctionConventions(funcTy, *this);

0 commit comments

Comments
 (0)