Skip to content

Commit 2d0b34a

Browse files
committed
---
yaml --- r: 326623 b: refs/heads/tensorflow c: 9c23a9e h: refs/heads/master i: 326621: 4f5c3b9 326619: 8fb8bf1 326615: 3b1a656 326607: fc8bf53 326591: 14b4b3d
1 parent ccc0a1e commit 2d0b34a

File tree

163 files changed

+8444
-11142
lines changed

Some content is hidden

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

163 files changed

+8444
-11142
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: 2d86f2398864995b544b874f34fd3ed24133ea39
819+
refs/heads/tensorflow: 9c23a9ef397b578aaf392befc2a6de12868f514e
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/ASTScope.h

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,8 @@ class ASTScopeImpl {
177177
void addChild(ASTScopeImpl *child, ASTContext &);
178178
std::vector<ASTScopeImpl *> rescueYoungestChildren(unsigned count);
179179

180-
/// When reexpanding, do we always create a new body?
181-
virtual NullablePtr<ASTScopeImpl> getParentOfRescuedScopes();
182-
std::vector<ASTScopeImpl *> rescueScopesToReuse();
183-
void addReusedScopes(ArrayRef<ASTScopeImpl *>);
180+
virtual std::vector<ASTScopeImpl *> rescueScopesToReuse();
181+
virtual void addReusedScopes(ArrayRef<ASTScopeImpl *>);
184182

185183
private:
186184
void removeChildren();
@@ -203,8 +201,7 @@ class ASTScopeImpl {
203201
/// InterpolatedStringLiteralExprs and EditorPlaceHolders respond to
204202
/// getSourceRange with the starting point. But we might be asked to lookup an
205203
/// identifer within one of them. So, find the real source range of them here.
206-
///
207-
/// FIXME: Alter how these are parsed so getSourceRange is enough.
204+
/// /// FIXME: Alter how these are parsed so getSourceRange is enough.
208205
SourceRange getEffectiveSourceRange(ASTNode) const;
209206

210207
void cacheSourceRangeOfMeAndDescendants(bool omitAssertions = false) const;
@@ -306,12 +303,6 @@ class ASTScopeImpl {
306303
virtual void beCurrent();
307304
virtual bool isCurrent() const;
308305

309-
/// Some scopes can be expanded lazily.
310-
/// Such scopes must: not change their source ranges after expansion, and
311-
/// their expansion must return an insertion point outside themselves.
312-
virtual NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion();
313-
virtual SourceRange sourceRangeForDeferredExpansion() const;
314-
315306
public:
316307
// Some nodes (VarDecls and Accessors) are created directly from
317308
// pattern scope code and should neither be deferred nor should
@@ -557,10 +548,6 @@ class Portion {
557548

558549
virtual void beCurrent(IterableTypeScope *) const;
559550
virtual bool isCurrent(const IterableTypeScope *) const;
560-
virtual NullablePtr<ASTScopeImpl>
561-
insertionPointForDeferredExpansion(IterableTypeScope *) const;
562-
virtual SourceRange
563-
sourceRangeForDeferredExpansion(const IterableTypeScope *) const;
564551
};
565552

566553
// For the whole Decl scope of a GenericType or an Extension
@@ -636,10 +623,6 @@ class IterableTypeBodyPortion final
636623

637624
void beCurrent(IterableTypeScope *) const override;
638625
bool isCurrent(const IterableTypeScope *) const override;
639-
NullablePtr<ASTScopeImpl>
640-
insertionPointForDeferredExpansion(IterableTypeScope *) const override;
641-
SourceRange
642-
sourceRangeForDeferredExpansion(const IterableTypeScope *) const override;
643626
};
644627

645628
/// GenericType or Extension scope
@@ -719,6 +702,7 @@ class IterableTypeScope : public GenericTypeScope {
719702
/// Because of \c parseDelayedDecl members can get added after the tree is
720703
/// constructed, and they can be out of order. Detect this happening by
721704
/// remembering the member count.
705+
/// TODO: unify with \c numberOfDeclsAlreadySeen
722706
unsigned memberCount = 0;
723707

724708
public:
@@ -737,8 +721,6 @@ class IterableTypeScope : public GenericTypeScope {
737721
public:
738722
void makeBodyCurrent();
739723
bool isBodyCurrent() const;
740-
NullablePtr<ASTScopeImpl> insertionPointForDeferredExpansion() override;
741-
SourceRange sourceRangeForDeferredExpansion() const override;
742724
};
743725

744726
class NominalTypeScope final : public IterableTypeScope {
@@ -976,7 +958,8 @@ class AbstractFunctionBodyScope : public ASTScopeImpl {
976958
Decl *getDecl() const { return decl; }
977959
static bool isAMethod(const AbstractFunctionDecl *);
978960

979-
NullablePtr<ASTScopeImpl> getParentOfRescuedScopes() override;
961+
std::vector<ASTScopeImpl *> rescueScopesToReuse() override;
962+
void addReusedScopes(ArrayRef<ASTScopeImpl *>) override;
980963

981964
protected:
982965
bool lookupLocalsOrMembers(ArrayRef<const ASTScopeImpl *>,
@@ -1139,6 +1122,7 @@ class PatternEntryDeclScope final : public AbstractPatternEntryScope {
11391122
SourceRange
11401123
getChildlessSourceRange(bool omitAssertions = false) const override;
11411124

1125+
static bool isHandledSpecially(const ASTNode n);
11421126
NullablePtr<const void> getReferrent() const override;
11431127

11441128
protected:
@@ -1388,7 +1372,8 @@ class TopLevelCodeScope final : public ASTScopeImpl {
13881372
Decl *getDecl() const { return decl; }
13891373
NullablePtr<const void> getReferrent() const override;
13901374

1391-
NullablePtr<ASTScopeImpl> getParentOfRescuedScopes() override;
1375+
std::vector<ASTScopeImpl *> rescueScopesToReuse() override;
1376+
void addReusedScopes(ArrayRef<ASTScopeImpl *>) override;
13921377
};
13931378

13941379
/// The \c _@specialize attribute.

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: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define SWIFT_AST_CLANG_MODULE_LOADER_H
1515

1616
#include "swift/AST/ModuleLoader.h"
17+
#include "swift/Demangling/Demangle.h"
1718

1819
namespace clang {
1920
class ASTContext;
@@ -27,24 +28,11 @@ namespace swift {
2728
class DeclContext;
2829
class VisibleDeclConsumer;
2930

30-
/// Represents the different namespaces for types in C.
31-
///
32-
/// A simplified version of clang::Sema::LookupKind.
33-
enum class ClangTypeKind {
34-
Typedef,
35-
ObjCClass = Typedef,
36-
/// Structs, enums, and unions.
37-
Tag,
38-
ObjCProtocol,
39-
};
40-
4131
class ClangModuleLoader : public ModuleLoader {
4232
private:
4333
virtual void anchor();
44-
4534
protected:
4635
using ModuleLoader::ModuleLoader;
47-
4836
public:
4937
virtual clang::ASTContext &getClangASTContext() const = 0;
5038
virtual clang::Preprocessor &getClangPreprocessor() const = 0;
@@ -68,23 +56,22 @@ class ClangModuleLoader : public ModuleLoader {
6856
///
6957
/// This routine is used for various hacks that are only permitted within
7058
/// overlays of imported modules, e.g., Objective-C bridging conformances.
71-
virtual bool
72-
isInOverlayModuleForImportedModule(const DeclContext *overlayDC,
73-
const DeclContext *importedDC) = 0;
59+
virtual bool isInOverlayModuleForImportedModule(
60+
const DeclContext *overlayDC,
61+
const DeclContext *importedDC) = 0;
7462

7563
/// Look for declarations associated with the given name.
7664
///
7765
/// \param name The name we're searching for.
78-
virtual void lookupValue(DeclName name, VisibleDeclConsumer &consumer) = 0;
66+
virtual void lookupValue(DeclName name, VisibleDeclConsumer &consumer) {}
7967

8068
/// Look up a type declaration by its Clang name.
8169
///
8270
/// Note that this method does no filtering. If it finds the type in a loaded
8371
/// module, it returns it. This is intended for use in reflection / debugging
8472
/// contexts where access is not a problem.
85-
virtual void
86-
lookupTypeDecl(StringRef clangName, ClangTypeKind kind,
87-
llvm::function_ref<void(TypeDecl *)> receiver) = 0;
73+
virtual void lookupTypeDecl(StringRef clangName, Demangle::Node::Kind kind,
74+
llvm::function_ref<void(TypeDecl *)> receiver) {}
8875

8976
/// Look up type a declaration synthesized by the Clang importer itself, using
9077
/// a "related entity kind" to determine which type it should be. For example,
@@ -95,11 +82,11 @@ class ClangModuleLoader : public ModuleLoader {
9582
/// module, it returns it. This is intended for use in reflection / debugging
9683
/// contexts where access is not a problem.
9784
virtual void
98-
lookupRelatedEntity(StringRef clangName, ClangTypeKind kind,
99-
StringRef relatedEntityKind,
100-
llvm::function_ref<void(TypeDecl *)> receiver) = 0;
85+
lookupRelatedEntity(StringRef clangName, StringRef relatedEntityKind,
86+
llvm::function_ref<void(TypeDecl *)> receiver) {}
10187
};
10288

10389
} // namespace swift
10490

10591
#endif // LLVM_SWIFT_AST_CLANG_MODULE_LOADER_H
92+

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

Lines changed: 20 additions & 41 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
@@ -1523,17 +1523,6 @@ class GenericContext : private _GenericContext, public DeclContext {
15231523

15241524
/// Determine whether this context has generic parameters
15251525
/// of its own.
1526-
///
1527-
/// \code
1528-
/// class C<T> {
1529-
/// func f1() {} // isGeneric == false
1530-
/// func f2<T>() {} // isGeneric == true
1531-
/// }
1532-
///
1533-
/// protocol P { // isGeneric == true due to implicit Self param
1534-
/// func p() // isGeneric == false
1535-
/// }
1536-
/// \endcode
15371526
bool isGeneric() const { return GenericParams != nullptr; }
15381527

15391528
/// Retrieve the trailing where clause for this extension, if any.
@@ -2412,20 +2401,12 @@ class ValueDecl : public Decl {
24122401
/// Whether this declaration is 'final'. A final class can't be subclassed,
24132402
/// a final class member can't be overriden.
24142403
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;
24222404
} LazySemanticInfo = { };
24232405

24242406
friend class OverriddenDeclsRequest;
24252407
friend class IsObjCRequest;
24262408
friend class IsFinalRequest;
24272409
friend class IsDynamicRequest;
2428-
friend class IsImplicitlyUnwrappedOptionalRequest;
24292410

24302411
protected:
24312412
ValueDecl(DeclKind K,
@@ -2694,21 +2675,6 @@ class ValueDecl : public Decl {
26942675
/// Returns true if this decl can be found by id-style dynamic lookup.
26952676
bool canBeAccessedByDynamicLookup() const;
26962677

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-
27122678
/// Returns the protocol requirements that this decl conforms to.
27132679
ArrayRef<ValueDecl *>
27142680
getSatisfiedProtocolRequirements(bool Sorted = false) const;
@@ -3221,6 +3187,19 @@ class AssociatedTypeDecl : public AbstractTypeParamDecl {
32213187

32223188
class MemberLookupTable;
32233189
class ConformanceLookupTable;
3190+
3191+
/// Kinds of optional types.
3192+
enum OptionalTypeKind : unsigned {
3193+
/// The type is not an optional type.
3194+
OTK_None = 0,
3195+
3196+
/// The type is Optional<T>.
3197+
OTK_Optional,
3198+
3199+
/// The type is ImplicitlyUnwrappedOptional<T>.
3200+
OTK_ImplicitlyUnwrappedOptional
3201+
};
3202+
enum { NumOptionalTypeKinds = 2 };
32243203

32253204
// Kinds of pointer types.
32263205
enum PointerTypeKind : unsigned {
@@ -6505,7 +6484,7 @@ class ConstructorDecl : public AbstractFunctionDecl {
65056484

65066485
public:
65076486
ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
6508-
bool Failable, SourceLoc FailabilityLoc,
6487+
OptionalTypeKind Failability, SourceLoc FailabilityLoc,
65096488
bool Throws, SourceLoc ThrowsLoc,
65106489
ParameterList *BodyParams,
65116490
GenericParamList *GenericParams,
@@ -6605,9 +6584,9 @@ class ConstructorDecl : public AbstractFunctionDecl {
66056584
llvm_unreachable("bad CtorInitializerKind");
66066585
}
66076586

6608-
/// Determine if this is a failable initializer.
6609-
bool isFailable() const {
6610-
return Bits.ConstructorDecl.Failable;
6587+
/// Determine the failability of the initializer.
6588+
OptionalTypeKind getFailability() const {
6589+
return static_cast<OptionalTypeKind>(Bits.ConstructorDecl.Failability);
66116590
}
66126591

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

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ ERROR(lex_illegal_multiline_string_end,none,
163163
"multi-line string literal closing delimiter must begin on a new line", ())
164164
ERROR(lex_multiline_string_indent_inconsistent,none,
165165
"%select{unexpected space in|unexpected tab in|insufficient}2 indentation of "
166-
"%select{line|next %1 lines}0 in multi-line string literal",
166+
"%select{line|next %1 lines}0 in multi-line string literal",
167167
(bool, unsigned, unsigned))
168168
NOTE(lex_multiline_string_indent_should_match_here,none,
169169
"should match %select{space|tab}0 here", (unsigned))
@@ -252,7 +252,7 @@ ERROR(cskeyword_not_attribute,none,
252252
"'%0' is a declaration modifier, not an attribute", (StringRef))
253253

254254
ERROR(decl_already_static,none,
255-
"%0 cannot appear after another 'static' or 'class' keyword", (StaticSpellingKind))
255+
"%0 specified twice", (StaticSpellingKind))
256256

257257
ERROR(enum_case_dot_prefix,none,
258258
"extraneous '.' in enum 'case' declaration", ())
@@ -881,7 +881,7 @@ WARNING(parameter_extraneous_double_up,none,
881881
"extraneous duplicate parameter name; %0 already has an argument "
882882
"label", (Identifier))
883883
ERROR(parameter_operator_keyword_argument,none,
884-
"%select{operator|closure|enum case}0 cannot have keyword arguments",
884+
"%select{operator|closure|enum case}0 cannot have keyword arguments",
885885
(unsigned))
886886

887887
ERROR(parameter_unnamed,none,

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

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5321,33 +5321,6 @@ class KeyPathDotExpr : public Expr {
53215321
}
53225322
};
53235323

5324-
/// Expression node that effects a "one-way" constraint in
5325-
/// the constraint system, allowing type information to flow from the
5326-
/// subexpression outward but not the other way.
5327-
///
5328-
/// One-way expressions are generally implicit and synthetic, introduced by
5329-
/// the type checker. However, there is a built-in expression of the
5330-
/// form \c Builtin.one_way(x) that forms a one-way constraint coming out
5331-
/// of expression `x` that can be used for testing purposes.
5332-
class OneWayExpr : public Expr {
5333-
Expr *SubExpr;
5334-
5335-
public:
5336-
/// Construct an implicit one-way expression from the given subexpression.
5337-
OneWayExpr(Expr *subExpr)
5338-
: Expr(ExprKind::OneWay, /*isImplicit=*/true), SubExpr(subExpr) { }
5339-
5340-
SourceLoc getLoc() const { return SubExpr->getLoc(); }
5341-
SourceRange getSourceRange() const { return SubExpr->getSourceRange(); }
5342-
5343-
Expr *getSubExpr() const { return SubExpr; }
5344-
void setSubExpr(Expr *subExpr) { SubExpr = subExpr; }
5345-
5346-
static bool classof(const Expr *E) {
5347-
return E->getKind() == ExprKind::OneWay;
5348-
}
5349-
};
5350-
53515324
inline bool Expr::isInfixOperator() const {
53525325
return isa<BinaryExpr>(this) || isa<IfExpr>(this) ||
53535326
isa<AssignExpr>(this) || isa<ExplicitCastExpr>(this);

0 commit comments

Comments
 (0)