Skip to content

Commit 7590b61

Browse files
committed
---
yaml --- r: 326652 b: refs/heads/tensorflow c: dd4c605 h: refs/heads/master
1 parent d0b6b38 commit 7590b61

File tree

104 files changed

+864
-1367
lines changed

Some content is hidden

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

104 files changed

+864
-1367
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: 586327ac33cdc250ad222dca00cff8207f019fbe
819+
refs/heads/tensorflow: dd4c6053a7c73f09eb889d0f629b7a06d4fa5b74
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/Expr.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,12 +3843,11 @@ class DynamicTypeExpr : public Expr {
38433843
/// node (say, an \c OpenExistentialExpr) and can only be used within the
38443844
/// subexpressions of that AST node.
38453845
class OpaqueValueExpr : public Expr {
3846-
SourceRange Range;
3846+
SourceLoc Loc;
38473847

38483848
public:
3849-
explicit OpaqueValueExpr(SourceRange Range, Type Ty,
3850-
bool isPlaceholder = false)
3851-
: Expr(ExprKind::OpaqueValue, /*Implicit=*/true, Ty), Range(Range) {
3849+
explicit OpaqueValueExpr(SourceLoc Loc, Type Ty, bool isPlaceholder = false)
3850+
: Expr(ExprKind::OpaqueValue, /*Implicit=*/true, Ty), Loc(Loc) {
38523851
Bits.OpaqueValueExpr.IsPlaceholder = isPlaceholder;
38533852
}
38543853

@@ -3857,8 +3856,8 @@ class OpaqueValueExpr : public Expr {
38573856
/// value to be specified later.
38583857
bool isPlaceholder() const { return Bits.OpaqueValueExpr.IsPlaceholder; }
38593858

3860-
SourceRange getSourceRange() const { return Range; }
3861-
3859+
SourceRange getSourceRange() const { return Loc; }
3860+
38623861
static bool classof(const Expr *E) {
38633862
return E->getKind() == ExprKind::OpaqueValue;
38643863
}

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

Lines changed: 8 additions & 24 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,8 +91,10 @@ 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

96+
ModuleDecl *loadModuleClang(SourceLoc importLoc,
97+
ArrayRef<std::pair<Identifier, SourceLoc>> path);
11198
public:
11299
/// Create a new Clang importer that can import a suitable Clang
113100
/// module into the given ASTContext.
@@ -130,7 +117,7 @@ class ClangImporter final : public ClangModuleLoader {
130117
static std::unique_ptr<ClangImporter>
131118
create(ASTContext &ctx, const ClangImporterOptions &importerOpts,
132119
std::string swiftPCHHash = "", DependencyTracker *tracker = nullptr,
133-
DWARFImporterDelegate *dwarfImporterDelegate = nullptr);
120+
std::unique_ptr<DWARFImporterDelegate> dwarfImporterDelegate = {});
134121

135122
ClangImporter(const ClangImporter &) = delete;
136123
ClangImporter(ClangImporter &&) = delete;
@@ -139,9 +126,6 @@ class ClangImporter final : public ClangModuleLoader {
139126

140127
~ClangImporter();
141128

142-
/// Only to be used by lldb-moduleimport-test.
143-
void setDWARFImporterDelegate(DWARFImporterDelegate &delegate);
144-
145129
/// Create a new clang::DependencyCollector customized to
146130
/// ClangImporter's specific uses.
147131
static std::shared_ptr<clang::DependencyCollector>
@@ -188,15 +172,15 @@ class ClangImporter final : public ClangModuleLoader {
188172
/// Look for declarations associated with the given name.
189173
///
190174
/// \param name The name we're searching for.
191-
void lookupValue(DeclName name, VisibleDeclConsumer &consumer) override;
175+
void lookupValue(DeclName name, VisibleDeclConsumer &consumer);
192176

193177
/// Look up a type declaration by its Clang name.
194178
///
195179
/// Note that this method does no filtering. If it finds the type in a loaded
196180
/// module, it returns it. This is intended for use in reflection / debugging
197181
/// contexts where access is not a problem.
198182
void lookupTypeDecl(StringRef clangName, ClangTypeKind kind,
199-
llvm::function_ref<void(TypeDecl *)> receiver) override;
183+
llvm::function_ref<void(TypeDecl *)> receiver);
200184

201185
/// Look up type a declaration synthesized by the Clang importer itself, using
202186
/// a "related entity kind" to determine which type it should be. For example,
@@ -209,7 +193,7 @@ class ClangImporter final : public ClangModuleLoader {
209193
void
210194
lookupRelatedEntity(StringRef clangName, ClangTypeKind kind,
211195
StringRef relatedEntityKind,
212-
llvm::function_ref<void(TypeDecl *)> receiver) override;
196+
llvm::function_ref<void(TypeDecl *)> receiver);
213197

214198
/// Look for textually included declarations from the bridging header.
215199
///

0 commit comments

Comments
 (0)