Skip to content

Commit 8fb8bf1

Browse files
committed
---
yaml --- r: 326619 b: refs/heads/tensorflow c: 1020d81 h: refs/heads/master i: 326617: 1e52bec 326615: 3b1a656
1 parent a592d1d commit 8fb8bf1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+527
-496
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: 5add16804272b4df917da15c46eb6f28d826d656
819+
refs/heads/tensorflow: 1020d8188af08438607d2dc2f2eff9618ca044b8
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/include/swift/AST/Attr.def

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,10 @@ DECL_ATTR(_restatedObjCConformance, RestatedObjCConformance,
348348
LongAttribute | RejectByParser |
349349
NotSerialized, 70)
350350
// NOTE: 71 is unused
351-
// NOTE: 72 is unused
351+
SIMPLE_DECL_ATTR(_implicitly_unwrapped_optional, ImplicitlyUnwrappedOptional,
352+
OnFunc | OnAccessor | OnVar | OnParam | OnSubscript | OnConstructor |
353+
RejectByParser,
354+
72)
352355
DECL_ATTR(_optimize, Optimize,
353356
OnAbstractFunction | OnSubscript | OnVar |
354357
UserInaccessible,

branches/tensorflow/include/swift/AST/Decl.h

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -456,16 +456,16 @@ class alignas(1 << DeclAlignInBits) Decl {
456456
IsTransparentComputed : 1
457457
);
458458

459-
SWIFT_INLINE_BITFIELD(ConstructorDecl, AbstractFunctionDecl, 3+1+1,
459+
SWIFT_INLINE_BITFIELD(ConstructorDecl, AbstractFunctionDecl, 3+2+1,
460460
/// The body initialization kind (+1), or zero if not yet computed.
461461
///
462462
/// This value is cached but is not serialized, because it is a property
463463
/// of the definition of the constructor that is useful only to semantic
464464
/// analysis and SIL generation.
465465
ComputedBodyInitKind : 3,
466466

467-
/// Whether this constructor can fail, by building an Optional type.
468-
Failable : 1,
467+
/// The failability of this initializer, which is an OptionalTypeKind.
468+
Failability : 2,
469469

470470
/// Whether this initializer is a stub placed into a subclass to
471471
/// catch invalid delegations to a designated initializer not
@@ -2412,20 +2412,12 @@ class ValueDecl : public Decl {
24122412
/// Whether this declaration is 'final'. A final class can't be subclassed,
24132413
/// a final class member can't be overriden.
24142414
unsigned isFinal : 1;
2415-
2416-
/// Whether the "isIUO" bit" has been computed yet.
2417-
unsigned isIUOComputed : 1;
2418-
2419-
/// Whether this declaration produces an implicitly unwrapped
2420-
/// optional result.
2421-
unsigned isIUO : 1;
24222415
} LazySemanticInfo = { };
24232416

24242417
friend class OverriddenDeclsRequest;
24252418
friend class IsObjCRequest;
24262419
friend class IsFinalRequest;
24272420
friend class IsDynamicRequest;
2428-
friend class IsImplicitlyUnwrappedOptionalRequest;
24292421

24302422
protected:
24312423
ValueDecl(DeclKind K,
@@ -2694,21 +2686,6 @@ class ValueDecl : public Decl {
26942686
/// Returns true if this decl can be found by id-style dynamic lookup.
26952687
bool canBeAccessedByDynamicLookup() const;
26962688

2697-
/// Returns true if this declaration has an implicitly unwrapped optional
2698-
/// result. The precise meaning depends on the declaration kind:
2699-
/// - for properties, the value is IUO
2700-
/// - for subscripts, the element type is IUO
2701-
/// - for functions, the result type is IUO
2702-
/// - for constructors, the failability kind is IUO
2703-
bool isImplicitlyUnwrappedOptional() const;
2704-
2705-
/// Should only be set on imported and deserialized declarations; parsed
2706-
/// declarations compute this lazily via a request.
2707-
void setImplicitlyUnwrappedOptional(bool isIUO) {
2708-
LazySemanticInfo.isIUOComputed = 1;
2709-
LazySemanticInfo.isIUO = isIUO;
2710-
}
2711-
27122689
/// Returns the protocol requirements that this decl conforms to.
27132690
ArrayRef<ValueDecl *>
27142691
getSatisfiedProtocolRequirements(bool Sorted = false) const;
@@ -3221,6 +3198,19 @@ class AssociatedTypeDecl : public AbstractTypeParamDecl {
32213198

32223199
class MemberLookupTable;
32233200
class ConformanceLookupTable;
3201+
3202+
/// Kinds of optional types.
3203+
enum OptionalTypeKind : unsigned {
3204+
/// The type is not an optional type.
3205+
OTK_None = 0,
3206+
3207+
/// The type is Optional<T>.
3208+
OTK_Optional,
3209+
3210+
/// The type is ImplicitlyUnwrappedOptional<T>.
3211+
OTK_ImplicitlyUnwrappedOptional
3212+
};
3213+
enum { NumOptionalTypeKinds = 2 };
32243214

32253215
// Kinds of pointer types.
32263216
enum PointerTypeKind : unsigned {
@@ -6505,7 +6495,7 @@ class ConstructorDecl : public AbstractFunctionDecl {
65056495

65066496
public:
65076497
ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
6508-
bool Failable, SourceLoc FailabilityLoc,
6498+
OptionalTypeKind Failability, SourceLoc FailabilityLoc,
65096499
bool Throws, SourceLoc ThrowsLoc,
65106500
ParameterList *BodyParams,
65116501
GenericParamList *GenericParams,
@@ -6605,9 +6595,9 @@ class ConstructorDecl : public AbstractFunctionDecl {
66056595
llvm_unreachable("bad CtorInitializerKind");
66066596
}
66076597

6608-
/// Determine if this is a failable initializer.
6609-
bool isFailable() const {
6610-
return Bits.ConstructorDecl.Failable;
6598+
/// Determine the failability of the initializer.
6599+
OptionalTypeKind getFailability() const {
6600+
return static_cast<OptionalTypeKind>(Bits.ConstructorDecl.Failability);
66116601
}
66126602

66136603
/// Retrieve the location of the '!' or '?' in a failable initializer.

branches/tensorflow/include/swift/AST/PrintOptions.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ struct PrintOptions {
292292
/// List of attribute kinds that should not be printed.
293293
std::vector<AnyAttrKind> ExcludeAttrList = {DAK_Transparent, DAK_Effects,
294294
DAK_FixedLayout,
295-
DAK_ShowInInterface};
295+
DAK_ShowInInterface,
296+
DAK_ImplicitlyUnwrappedOptional};
296297

297298
/// List of attribute kinds that should be printed exclusively.
298299
/// Empty means allow all.

branches/tensorflow/include/swift/AST/TypeCheckRequests.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,27 +1031,6 @@ class EmittedMembersRequest :
10311031
void cacheResult(DeclRange value) const;
10321032
};
10331033

1034-
class IsImplicitlyUnwrappedOptionalRequest :
1035-
public SimpleRequest<IsImplicitlyUnwrappedOptionalRequest,
1036-
bool(ValueDecl *),
1037-
CacheKind::SeparatelyCached> {
1038-
public:
1039-
using SimpleRequest::SimpleRequest;
1040-
1041-
private:
1042-
friend SimpleRequest;
1043-
1044-
// Evaluation.
1045-
llvm::Expected<bool>
1046-
evaluate(Evaluator &evaluator, ValueDecl *value) const;
1047-
1048-
public:
1049-
// Separate caching.
1050-
bool isCached() const { return true; }
1051-
Optional<bool> getCachedResult() const;
1052-
void cacheResult(bool value) const;
1053-
};
1054-
10551034
// Allow AnyValue to compare two Type values, even though Type doesn't
10561035
// support ==.
10571036
template<>

branches/tensorflow/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,3 @@ SWIFT_TYPEID(RequiresOpaqueModifyCoroutineRequest)
5555
SWIFT_TYPEID(IsAccessorTransparentRequest)
5656
SWIFT_TYPEID(SynthesizeAccessorRequest)
5757
SWIFT_TYPEID(EmittedMembersRequest)
58-
SWIFT_TYPEID(IsImplicitlyUnwrappedOptionalRequest)

branches/tensorflow/include/swift/ClangImporter/ClangImporter.h

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,6 @@ class TypeDecl;
6060
class VisibleDeclConsumer;
6161
enum class SelectorSplitKind;
6262

63-
/// Kinds of optional types.
64-
enum OptionalTypeKind : unsigned {
65-
/// The type is not an optional type.
66-
OTK_None = 0,
67-
68-
/// The type is Optional<T>.
69-
OTK_Optional,
70-
71-
/// The type is ImplicitlyUnwrappedOptional<T>.
72-
OTK_ImplicitlyUnwrappedOptional
73-
};
74-
enum { NumOptionalTypeKinds = 2 };
75-
7663
/// This interface is implemented by LLDB to serve as a fallback when Clang
7764
/// modules can't be imported from source in the debugger.
7865
///
@@ -141,6 +128,9 @@ class ClangImporter final : public ClangModuleLoader {
141128

142129
~ClangImporter();
143130

131+
/// Only to be used by lldb-moduleimport-test.
132+
void setDWARFImporterDelegate(DWARFImporterDelegate &delegate);
133+
144134
/// Create a new clang::DependencyCollector customized to
145135
/// ClangImporter's specific uses.
146136
static std::shared_ptr<clang::DependencyCollector>

branches/tensorflow/include/swift/Parse/Parser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,7 @@ class Parser {
10191019
ParserStatus parseGetSet(ParseDeclOptions Flags,
10201020
GenericParamList *GenericParams,
10211021
ParameterList *Indices,
1022+
TypeLoc ElementTy,
10221023
ParsedAccessors &accessors,
10231024
AbstractStorageDecl *storage,
10241025
SourceLoc StaticLoc);

branches/tensorflow/include/swift/Serialization/ModuleFormat.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 511; // ctor failability change
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 509; // [dynamic_lifetime] sil flag
5656

5757
using DeclIDField = BCFixed<31>;
5858

@@ -409,6 +409,15 @@ enum class AccessLevel : uint8_t {
409409
};
410410
using AccessLevelField = BCFixed<3>;
411411

412+
// These IDs must \em not be renumbered or reordered without incrementing
413+
// the module version.
414+
enum class OptionalTypeKind : uint8_t {
415+
None,
416+
Optional,
417+
ImplicitlyUnwrappedOptional
418+
};
419+
using OptionalTypeKindField = BCFixed<2>;
420+
412421
// These IDs must \em not be renumbered or reordered without incrementing
413422
// the module version.
414423
enum class DeclNameKind: uint8_t {
@@ -1010,8 +1019,7 @@ namespace decls_block {
10101019
using ConstructorLayout = BCRecordLayout<
10111020
CONSTRUCTOR_DECL,
10121021
DeclContextIDField, // context decl
1013-
BCFixed<1>, // failable?
1014-
BCFixed<1>, // IUO result?
1022+
OptionalTypeKindField, // failability
10151023
BCFixed<1>, // implicit?
10161024
BCFixed<1>, // objc?
10171025
BCFixed<1>, // stub implementation?
@@ -1051,7 +1059,6 @@ namespace decls_block {
10511059
ReadWriteImplKindField, // read-write implementation
10521060
AccessorCountField, // number of accessors
10531061
TypeIDField, // interface type
1054-
BCFixed<1>, // IUO value?
10551062
DeclIDField, // overridden decl
10561063
AccessLevelField, // access level
10571064
AccessLevelField, // setter access, if applicable
@@ -1068,7 +1075,6 @@ namespace decls_block {
10681075
DeclContextIDField, // context decl
10691076
ParamDeclSpecifierField, // specifier
10701077
TypeIDField, // interface type
1071-
BCFixed<1>, // isIUO?
10721078
BCFixed<1>, // isVariadic?
10731079
BCFixed<1>, // isAutoClosure?
10741080
DefaultArgumentField, // default argument kind
@@ -1087,7 +1093,6 @@ namespace decls_block {
10871093
BCFixed<1>, // throws?
10881094
GenericEnvironmentIDField, // generic environment
10891095
TypeIDField, // result interface type
1090-
BCFixed<1>, // IUO result?
10911096
DeclIDField, // operator decl
10921097
DeclIDField, // overridden function
10931098
BCVBR<5>, // 0 for a simple name, otherwise the number of parameter name
@@ -1129,7 +1134,6 @@ namespace decls_block {
11291134
BCFixed<1>, // throws?
11301135
GenericEnvironmentIDField, // generic environment
11311136
TypeIDField, // result interface type
1132-
BCFixed<1>, // IUO result?
11331137
DeclIDField, // overridden function
11341138
DeclIDField, // AccessorStorageDecl
11351139
AccessorKindField, // accessor kind
@@ -1216,7 +1220,6 @@ namespace decls_block {
12161220
AccessorCountField, // number of accessors
12171221
GenericEnvironmentIDField, // generic environment
12181222
TypeIDField, // element interface type
1219-
BCFixed<1>, // IUO element?
12201223
DeclIDField, // overridden decl
12211224
AccessLevelField, // access level
12221225
AccessLevelField, // setter access, if applicable

branches/tensorflow/lib/AST/ASTDumper.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,15 @@ static StringRef getCtorInitializerKindString(CtorInitializerKind value) {
370370

371371
llvm_unreachable("Unhandled CtorInitializerKind in switch.");
372372
}
373+
static StringRef getOptionalTypeKindString(OptionalTypeKind value) {
374+
switch (value) {
375+
case OTK_None: return "none";
376+
case OTK_Optional: return "Optional";
377+
case OTK_ImplicitlyUnwrappedOptional: return "ImplicitlyUnwrappedOptional";
378+
}
379+
380+
llvm_unreachable("Unhandled OptionalTypeKind in switch.");
381+
}
373382
static StringRef getAssociativityString(Associativity value) {
374383
switch (value) {
375384
case Associativity::None: return "none";
@@ -1091,11 +1100,9 @@ namespace {
10911100
PrintWithColorRAII(OS, DeclModifierColor) << " required";
10921101
PrintWithColorRAII(OS, DeclModifierColor) << " "
10931102
<< getCtorInitializerKindString(CD->getInitKind());
1094-
if (CD->isFailable())
1103+
if (CD->getFailability() != OTK_None)
10951104
PrintWithColorRAII(OS, DeclModifierColor) << " failable="
1096-
<< (CD->isImplicitlyUnwrappedOptional()
1097-
? "ImplicitlyUnwrappedOptional"
1098-
: "Optional");
1105+
<< getOptionalTypeKindString(CD->getFailability());
10991106
printAbstractFunctionDecl(CD);
11001107
PrintWithColorRAII(OS, ParenthesisColor) << ')';
11011108
}

0 commit comments

Comments
 (0)