Skip to content

Commit f5adfa2

Browse files
committed
[SIL] Deoptionalize asFullApplySite.
The FullApplySite itself can already be null, and indeed this function was producing `llvm::Some(FullApplySite())` when called on ApplySite instances which weren't actually full.
1 parent 3113e83 commit f5adfa2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/swift/SIL/ApplySite.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,9 +541,9 @@ class ApplySite {
541541

542542
void dump() const LLVM_ATTRIBUTE_USED { getInstruction()->dump(); }
543543

544-
/// Attempt to cast this apply site to a full apply site, returning None on
545-
/// failure.
546-
llvm::Optional<FullApplySite> asFullApplySite() const;
544+
/// Form a FullApplySite. Note that it will be null if this apply site is not
545+
/// in fact a FullApplySite.
546+
FullApplySite asFullApplySite() const;
547547
};
548548

549549
//===----------------------------------------------------------------------===//
@@ -818,15 +818,15 @@ template <> struct DenseMapInfo<::swift::FullApplySite> {
818818

819819
namespace swift {
820820

821-
inline llvm::Optional<FullApplySite> ApplySite::asFullApplySite() const {
821+
inline FullApplySite ApplySite::asFullApplySite() const {
822822
return FullApplySite::isa(getInstruction());
823823
}
824824

825825
inline bool ApplySite::isIndirectResultOperand(const Operand &op) const {
826826
auto fas = asFullApplySite();
827827
if (!fas)
828828
return false;
829-
return fas->isIndirectResultOperand(op);
829+
return fas.isIndirectResultOperand(op);
830830
}
831831

832832
} // namespace swift

0 commit comments

Comments
 (0)