AST: Banish OptionalTypeKind to ClangImporter.h

The only place this was used in Decl.h was the failability kind of a
constructor.

I decided to replace this with a boolean isFailable() bit. Now that
we have isImplicitlyUnwrappedOptional(), it seems to make more sense
to not have ConstructorDecl represent redundant information which
might not be internally consistent.

Most callers of getFailability() actually only care if the result is
failable or not; the few callers that care about it being IUO can
check isImplicitlyUnwrappedOptional() as well.
This commit is contained in:
Slava Pestov
2019-08-15 17:07:42 -04:00
parent 19d283d9dc
commit 1c3ac86796
30 changed files with 125 additions and 189 deletions

View File

@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_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 SWIFTMODULE_VERSION_MINOR = 510; // serialize isIUO bit on ValueDecls
const uint16_t SWIFTMODULE_VERSION_MINOR = 511; // ctor failability change
using DeclIDField = BCFixed<31>;
@@ -409,15 +409,6 @@ enum class AccessLevel : uint8_t {
};
using AccessLevelField = BCFixed<3>;
// These IDs must \em not be renumbered or reordered without incrementing
// the module version.
enum class OptionalTypeKind : uint8_t {
None,
Optional,
ImplicitlyUnwrappedOptional
};
using OptionalTypeKindField = BCFixed<2>;
// These IDs must \em not be renumbered or reordered without incrementing
// the module version.
enum class DeclNameKind: uint8_t {
@@ -1019,7 +1010,8 @@ namespace decls_block {
using ConstructorLayout = BCRecordLayout<
CONSTRUCTOR_DECL,
DeclContextIDField, // context decl
OptionalTypeKindField, // failability
BCFixed<1>, // failable?
BCFixed<1>, // IUO result?
BCFixed<1>, // implicit?
BCFixed<1>, // objc?
BCFixed<1>, // stub implementation?