Files
swift-mirror/include/swift/SIL/ValueUtils.h
Michael Gottesman fed6145922 [sil] Change all single value instructions with forwarding ownership to have static ownership.
Previously we would always calculate these instructions ownership dynamically
when asked and rely on the ownership verifier to catch if we made any
mistakes. Instead with this commit we move to a more static model where the
ownership that these instructions can take are frozen on construction. This is a
more static model that simplifies the ownership model.

I also eliminated a few asserts that are enforced in other places that caused
problems when parsing since we may not have a Function while Parsing (it was
generally asserts if a type was trivial).
2018-11-11 15:23:36 -08:00

30 lines
992 B
C++

//===--- ValueUtils.h -----------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2018 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_SIL_VALUEUTILS_H
#define SWIFT_SIL_VALUEUTILS_H
#include "swift/SIL/SILValue.h"
namespace swift {
/// Attempt to merge the ValueOwnershipKind of the passed in range's
/// SILValues. Returns Optional<None> if we found an incompatibility.
///
/// NOTE: This assumes that the passed in SILValues are not values used as type
/// dependent operands.
Optional<ValueOwnershipKind> mergeSILValueOwnership(ArrayRef<SILValue> values);
} // namespace swift
#endif