Skip to content

Commit 4f5c3b9

Browse files
committed
---
yaml --- r: 326621 b: refs/heads/tensorflow c: 787b6cb h: refs/heads/master i: 326619: 8fb8bf1
1 parent af27642 commit 4f5c3b9

File tree

109 files changed

+7463
-9556
lines changed

Some content is hidden

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

109 files changed

+7463
-9556
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: 2ae84202c4963b36daf63199318eff1498d0e9dd
819+
refs/heads/tensorflow: 787b6cb8a4e71dbf8eacc8fdd5366b640dc7b8a7
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/ABI/Metadata.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2340,12 +2340,6 @@ struct TargetProtocolConformanceDescriptor final
23402340
return TypeRef.getTypeDescriptor(getTypeKind());
23412341
}
23422342

2343-
const TargetContextDescriptor<Runtime> **_getTypeDescriptorLocation() const {
2344-
if (getTypeKind() != TypeReferenceKind::IndirectTypeDescriptor)
2345-
return nullptr;
2346-
return TypeRef.IndirectTypeDescriptor.get();
2347-
}
2348-
23492343
/// Retrieve the context of a retroactive conformance.
23502344
const TargetContextDescriptor<Runtime> *getRetroactiveContext() const {
23512345
if (!Flags.isRetroactive()) return nullptr;

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/ClangModuleLoader.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -71,33 +71,6 @@ class ClangModuleLoader : public ModuleLoader {
7171
virtual bool
7272
isInOverlayModuleForImportedModule(const DeclContext *overlayDC,
7373
const DeclContext *importedDC) = 0;
74-
75-
/// Look for declarations associated with the given name.
76-
///
77-
/// \param name The name we're searching for.
78-
virtual void lookupValue(DeclName name, VisibleDeclConsumer &consumer) = 0;
79-
80-
/// Look up a type declaration by its Clang name.
81-
///
82-
/// Note that this method does no filtering. If it finds the type in a loaded
83-
/// module, it returns it. This is intended for use in reflection / debugging
84-
/// contexts where access is not a problem.
85-
virtual void
86-
lookupTypeDecl(StringRef clangName, ClangTypeKind kind,
87-
llvm::function_ref<void(TypeDecl *)> receiver) = 0;
88-
89-
/// Look up type a declaration synthesized by the Clang importer itself, using
90-
/// a "related entity kind" to determine which type it should be. For example,
91-
/// this can be used to find the synthesized error struct for an
92-
/// NS_ERROR_ENUM.
93-
///
94-
/// Note that this method does no filtering. If it finds the type in a loaded
95-
/// module, it returns it. This is intended for use in reflection / debugging
96-
/// contexts where access is not a problem.
97-
virtual void
98-
lookupRelatedEntity(StringRef clangName, ClangTypeKind kind,
99-
StringRef relatedEntityKind,
100-
llvm::function_ref<void(TypeDecl *)> receiver) = 0;
10174
};
10275

10376
} // namespace swift

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/Type.h

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,7 @@ class Type {
374374
class CanType : public Type {
375375
bool isActuallyCanonicalOrNull() const;
376376

377-
static bool isReferenceTypeImpl(CanType type, GenericSignature *sig,
378-
bool functionsCount);
377+
static bool isReferenceTypeImpl(CanType type, bool functionsCount);
379378
static bool isExistentialTypeImpl(CanType type);
380379
static bool isAnyExistentialTypeImpl(CanType type);
381380
static bool isObjCExistentialTypeImpl(CanType type);
@@ -409,26 +408,8 @@ class CanType : public Type {
409408
// Provide a few optimized accessors that are really type-class queries.
410409

411410
/// Do values of this type have reference semantics?
412-
///
413-
/// This includes isAnyClassReferenceType(), as well as function types.
414411
bool hasReferenceSemantics() const {
415-
return isReferenceTypeImpl(*this,
416-
/*signature*/ nullptr,
417-
/*functions count*/ true);
418-
}
419-
420-
/// Are variables of this type permitted to have
421-
/// ownership attributes?
422-
///
423-
/// This includes:
424-
/// - class types, generic or not
425-
/// - archetypes with class or class protocol bounds
426-
/// - existentials with class or class protocol bounds
427-
/// But not:
428-
/// - function types
429-
bool allowsOwnership(GenericSignature *sig) const {
430-
return isReferenceTypeImpl(*this, sig,
431-
/*functions count*/ false);
412+
return isReferenceTypeImpl(*this, /*functions count*/ true);
432413
}
433414

434415
/// Are values of this type essentially just class references,
@@ -438,13 +419,10 @@ class CanType : public Type {
438419
/// - a class type
439420
/// - a bound generic class type
440421
/// - a class-bounded archetype type
441-
/// - a class-bounded type parameter
442422
/// - a class-bounded existential type
443423
/// - a dynamic Self type
444424
bool isAnyClassReferenceType() const {
445-
return isReferenceTypeImpl(*this,
446-
/*signature*/ nullptr,
447-
/*functions count*/ false);
425+
return isReferenceTypeImpl(*this, /*functions count*/ false);
448426
}
449427

450428
/// Is this type existential?

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/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ class alignas(1 << TypeAlignInBits) TypeBase {
541541

542542
/// allowsOwnership() - Are variables of this type permitted to have
543543
/// ownership attributes?
544-
bool allowsOwnership(GenericSignature *sig=nullptr);
544+
bool allowsOwnership();
545545

546546
/// Determine whether this type involves a type variable.
547547
bool hasTypeVariable() const {

branches/tensorflow/include/swift/Basic/Statistics.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ FRONTEND_STATISTIC(Sema, NumLeafScopes)
166166
/// This is a measure of complexity of the contraction algorithm.
167167
FRONTEND_STATISTIC(Sema, NumConstraintsConsideredForEdgeContraction)
168168

169-
/// Number of constraint-solving scopes created in the typechecker, while
170-
/// solving expression type constraints. A rough proxy for "how much work the
171-
/// expression typechecker did".
172-
FRONTEND_STATISTIC(Sema, NumCyclicOneWayComponentsCollapsed)
173-
174169
/// Number of declarations that were deserialized. A rough proxy for the amount
175170
/// of material loaded from other modules.
176171
FRONTEND_STATISTIC(Sema, NumDeclsDeserialized)

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

Lines changed: 6 additions & 26 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
///
@@ -84,13 +71,11 @@ enum { NumOptionalTypeKinds = 2 };
8471
/// Clang AST to ClangImporter to import the type into Swift.
8572
class DWARFImporterDelegate {
8673
public:
87-
virtual ~DWARFImporterDelegate() = default;
74+
virtual ~DWARFImporterDelegate() {}
8875
/// Perform a qualified lookup of a Clang type with this name.
8976
/// \param kind Only return results with this type kind.
9077
virtual void lookupValue(StringRef name, llvm::Optional<ClangTypeKind> kind,
9178
SmallVectorImpl<clang::Decl *> &results) {}
92-
/// vtable anchor.
93-
virtual void anchor();
9479
};
9580

9681
/// Class that imports Clang modules into Swift, mapping directly
@@ -106,10 +91,8 @@ class ClangImporter final : public ClangModuleLoader {
10691

10792
ClangImporter(ASTContext &ctx, const ClangImporterOptions &clangImporterOpts,
10893
DependencyTracker *tracker,
109-
DWARFImporterDelegate *dwarfImporterDelegate);
94+
std::unique_ptr<DWARFImporterDelegate> dwarfImporterDelegate);
11095

111-
ModuleDecl *loadModuleClang(SourceLoc importLoc,
112-
ArrayRef<std::pair<Identifier, SourceLoc>> path);
11396
public:
11497
/// Create a new Clang importer that can import a suitable Clang
11598
/// module into the given ASTContext.
@@ -132,7 +115,7 @@ class ClangImporter final : public ClangModuleLoader {
132115
static std::unique_ptr<ClangImporter>
133116
create(ASTContext &ctx, const ClangImporterOptions &importerOpts,
134117
std::string swiftPCHHash = "", DependencyTracker *tracker = nullptr,
135-
DWARFImporterDelegate *dwarfImporterDelegate = nullptr);
118+
std::unique_ptr<DWARFImporterDelegate> dwarfImporterDelegate = {});
136119

137120
ClangImporter(const ClangImporter &) = delete;
138121
ClangImporter(ClangImporter &&) = delete;
@@ -141,9 +124,6 @@ class ClangImporter final : public ClangModuleLoader {
141124

142125
~ClangImporter();
143126

144-
/// Only to be used by lldb-moduleimport-test.
145-
void setDWARFImporterDelegate(DWARFImporterDelegate &delegate);
146-
147127
/// Create a new clang::DependencyCollector customized to
148128
/// ClangImporter's specific uses.
149129
static std::shared_ptr<clang::DependencyCollector>
@@ -190,15 +170,15 @@ class ClangImporter final : public ClangModuleLoader {
190170
/// Look for declarations associated with the given name.
191171
///
192172
/// \param name The name we're searching for.
193-
void lookupValue(DeclName name, VisibleDeclConsumer &consumer) override;
173+
void lookupValue(DeclName name, VisibleDeclConsumer &consumer);
194174

195175
/// Look up a type declaration by its Clang name.
196176
///
197177
/// Note that this method does no filtering. If it finds the type in a loaded
198178
/// module, it returns it. This is intended for use in reflection / debugging
199179
/// contexts where access is not a problem.
200180
void lookupTypeDecl(StringRef clangName, ClangTypeKind kind,
201-
llvm::function_ref<void(TypeDecl *)> receiver) override;
181+
llvm::function_ref<void(TypeDecl *)> receiver);
202182

203183
/// Look up type a declaration synthesized by the Clang importer itself, using
204184
/// a "related entity kind" to determine which type it should be. For example,
@@ -211,7 +191,7 @@ class ClangImporter final : public ClangModuleLoader {
211191
void
212192
lookupRelatedEntity(StringRef clangName, ClangTypeKind kind,
213193
StringRef relatedEntityKind,
214-
llvm::function_ref<void(TypeDecl *)> receiver) override;
194+
llvm::function_ref<void(TypeDecl *)> receiver);
215195

216196
/// Look for textually included declarations from the bridging header.
217197
///

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);

0 commit comments

Comments
 (0)