(De-)serialization for foreign error conventions.

Currently untestable (due to SILGen's inability to handle throwing
@objc methods), but testing will become trivial once that's in place.

Swift SVN r27294
This commit is contained in:
Doug Gregor
2015-04-14 22:57:44 +00:00
parent 9a36586377
commit 759346e5b8
6 changed files with 172 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ const uint16_t VERSION_MAJOR = 0;
/// To ensure that two separate changes don't silently get merged into one
/// in source control, you should also update the comment to briefly
/// describe what change you made.
const uint16_t VERSION_MINOR = 191; // Last change: consolidate function type representations
const uint16_t VERSION_MINOR = 192; // Last change: foreign error convention
using DeclID = Fixnum<31>;
using DeclIDField = BCFixed<31>;
@@ -115,6 +115,15 @@ enum class FunctionTypeRepresentation : uint8_t {
};
using FunctionTypeRepresentationField = BCFixed<4>;
enum class ForeignErrorConventionKind : uint8_t {
ZeroResult,
NonZeroResult,
NilResult,
NonNilError,
};
using ForeignErrorConventionKindField = BCFixed<2>;
// These IDs must \em not be renumbered or reordered without incrementing
// VERSION_MAJOR.
enum class SILFunctionTypeRepresentation : uint8_t {
@@ -1200,6 +1209,15 @@ namespace decls_block {
BCFixed<1> // is a decl
>;
using ForeignErrorConventionLayout = BCRecordLayout<
FOREIGN_ERROR_CONVENTION,
ForeignErrorConventionKindField, // kind
BCFixed<1>, // owned
BCVBR<4>, // error parameter index
TypeIDField, // error parameter type
TypeIDField // result type
>;
using AbstractClosureExprLayout = BCRecordLayout<
ABSTRACT_CLOSURE_EXPR_CONTEXT,
TypeIDField, // type