[AST] Introduce "ValueOwnership" collecting __shared, inout, etc.

This is designed to stop having to n bits to track each of the
mutually exclusive 'shared', 'inout' and eventually 'owned'.
This commit is contained in:
Huon Wilson
2018-02-26 17:08:05 -08:00
parent b94c5364f5
commit 12871d75bc
10 changed files with 148 additions and 51 deletions

View File

@@ -55,7 +55,7 @@ const uint16_t VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t VERSION_MINOR = 400; // Last change: sil_property
const uint16_t VERSION_MINOR = 401; // Last change: ValueOwnership
using DeclIDField = BCFixed<31>;
@@ -319,6 +319,15 @@ enum ReferenceOwnership : uint8_t {
};
using ReferenceOwnershipField = BCFixed<2>;
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR.
enum ValueOwnership : uint8_t {
Default = 0,
InOut,
Shared,
};
using ValueOwnershipField = BCFixed<2>;
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR.
enum class DefaultArgumentKind : uint8_t {
@@ -656,8 +665,7 @@ namespace decls_block {
BCFixed<1>, // vararg?
BCFixed<1>, // autoclosure?
BCFixed<1>, // escaping?
BCFixed<1>, // inout?
BCFixed<1> // shared?
ValueOwnershipField // inout, shared or owned?
>;
using TupleTypeLayout = BCRecordLayout<
@@ -671,8 +679,7 @@ namespace decls_block {
BCFixed<1>, // vararg?
BCFixed<1>, // autoclosure?
BCFixed<1>, // escaping?
BCFixed<1>, // inout?
BCFixed<1> // shared?
ValueOwnershipField // inout, shared or owned?
>;
using FunctionTypeLayout = BCRecordLayout<