Skip to content

Commit 19f6d74

Browse files
---
yaml --- r: 348891 b: refs/heads/master c: 76aeffc h: refs/heads/master i: 348889: aa08682 348887: c173b2f
1 parent f064f6c commit 19f6d74

File tree

165 files changed

+1839
-2158
lines changed

Some content is hidden

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

165 files changed

+1839
-2158
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5ce10d1e8efee90b815ce51c4a43d7d3b2cc9bc0
2+
refs/heads/master: 76aeffc06dc346ca389217eda4c2e64c389059d3
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ set(SWIFT_ANALYZE_CODE_COVERAGE FALSE CACHE STRING
125125
# SWIFT_VERSION is deliberately /not/ cached so that an existing build directory
126126
# can be reused when a new version of Swift comes out (assuming the user hasn't
127127
# manually set it as part of their own CMake configuration).
128-
set(SWIFT_VERSION "5.1.1")
128+
set(SWIFT_VERSION "5.1")
129129

130130
set(SWIFT_VENDOR "" CACHE STRING
131131
"The vendor name of the Swift compiler")

trunk/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| | **Architecture** | **Master** | **Package** |
77
|---|:---:|:---:|:---:|
88
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-osx)|[![Build Status](https://ci.swift.org/job/oss-swift-package-osx/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-osx)|
9+
| **Ubuntu 14.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-14_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-14_04)|
910
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
1011
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
1112

trunk/cmake/modules/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ set(SWIFT_LIBRARY_DIRS ${SWIFT_LIBRARY_OUTPUT_INTDIR})
1616
configure_file(
1717
SwiftConfig.cmake.in
1818
${swift_cmake_builddir}/SwiftConfig.cmake
19-
@ONLY)
19+
@ONLY)

trunk/cmake/modules/SwiftConfig.cmake.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ set(SWIFT_VERSION @SWIFT_VERSION@)
66
set(SWIFT_MAIN_SRC_DIR @SWIFT_SOURCE_DIR@)
77

88
set(SWIFT_INCLUDE_DIRS "@SWIFT_INCLUDE_DIRS@")
9-
set(SWIFT_LIBRARY_DIRS "@SWIFT_LIBRARY_DIRS@")
9+
set(SWIFT_LIBRARY_DIRS "@SWIFT_CONFIG_LIBRARY_DIRS@")
1010

1111
# These variables are duplicated, but they must match the LLVM variables of the
1212
# same name. The variables ending in "S" could some day become lists, and are
1313
# preserved for convention and compatibility.
1414
set(SWIFT_INCLUDE_DIR "@SWIFT_INCLUDE_DIRS@")
15-
set(SWIFT_LIBRARY_DIR "@SWIFT_LIBRARY_DIRS@")
15+
set(SWIFT_LIBRARY_DIR "@SWIFT_CONFIG_LIBRARY_DIRS@")
1616

1717
set(SWIFT_CMAKE_DIR "@SWIFT_CMAKE_DIR@")
1818
set(SWIFT_BINARY_DIR "@SWIFT_BINARY_DIR@")

trunk/include/swift/AST/ASTDemangler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ class ASTBuilder {
5858
using BuiltTypeDecl = swift::GenericTypeDecl *; // nominal or type alias
5959
using BuiltProtocolDecl = swift::ProtocolDecl *;
6060
explicit ASTBuilder(ASTContext &ctx) : Ctx(ctx) {}
61+
62+
/// The resolver to use for type checking, if necessary.
63+
LazyResolver *Resolver = nullptr;
6164

6265
ASTContext &getASTContext() { return Ctx; }
6366
DeclContext *getNotionalDC();

trunk/include/swift/AST/ASTTypeIDZone.def

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ SWIFT_TYPEID_NAMED(InfixOperatorDecl *, InfixOperatorDecl)
3333
SWIFT_TYPEID_NAMED(IterableDeclContext *, IterableDeclContext)
3434
SWIFT_TYPEID_NAMED(ModuleDecl *, ModuleDecl)
3535
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
36-
SWIFT_TYPEID_NAMED(OpaqueTypeDecl *, OpaqueTypeDecl)
3736
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
3837
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
3938
PropertyWrapperMutability)

trunk/include/swift/AST/ASTTypeIDs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class IterableDeclContext;
3434
class ModuleDecl;
3535
class NominalTypeDecl;
3636
class OperatorDecl;
37-
class OpaqueTypeDecl;
3837
class PrecedenceGroupDecl;
3938
struct PropertyWrapperBackingPropertyInfo;
4039
struct PropertyWrapperTypeInfo;

trunk/include/swift/AST/AnyRequest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class AnyRequest {
5454
friend llvm::DenseMapInfo<swift::AnyRequest>;
5555

5656
static hash_code hashForHolder(uint64_t typeID, hash_code requestHash) {
57-
return hash_combine(typeID, requestHash);
57+
return hash_combine(hash_value(typeID), requestHash);
5858
}
5959

6060
/// Abstract base class used to hold the specific request kind.

trunk/include/swift/AST/Decl.h

Lines changed: 81 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,12 @@ class alignas(1 << DeclAlignInBits) Decl {
340340
IsUserAccessible : 1
341341
);
342342

343-
SWIFT_INLINE_BITFIELD(AbstractStorageDecl, ValueDecl, 1,
343+
SWIFT_INLINE_BITFIELD(AbstractStorageDecl, ValueDecl, 1+1+1,
344+
/// Whether a keypath component can directly reference this storage,
345+
/// or if it must use the overridden declaration instead.
346+
HasComputedValidKeyPathComponent : 1,
347+
ValidKeyPathComponent : 1,
348+
344349
/// Whether this property is a type property (currently unfortunately
345350
/// called 'static').
346351
IsStatic : 1
@@ -388,7 +393,7 @@ class alignas(1 << DeclAlignInBits) Decl {
388393
SWIFT_INLINE_BITFIELD(SubscriptDecl, VarDecl, 2,
389394
StaticSpelling : 2
390395
);
391-
SWIFT_INLINE_BITFIELD(AbstractFunctionDecl, ValueDecl, 3+8+1+1+1+1+1+1,
396+
SWIFT_INLINE_BITFIELD(AbstractFunctionDecl, ValueDecl, 3+8+1+1+1+1+1+1+1+1,
392397
/// \see AbstractFunctionDecl::BodyKind
393398
BodyKind : 3,
394399

@@ -404,6 +409,12 @@ class alignas(1 << DeclAlignInBits) Decl {
404409
/// Whether the function body throws.
405410
Throws : 1,
406411

412+
/// Whether this function requires a new vtable entry.
413+
NeedsNewVTableEntry : 1,
414+
415+
/// Whether NeedsNewVTableEntry is valid.
416+
HasComputedNeedsNewVTableEntry : 1,
417+
407418
/// Whether this member was synthesized as part of a derived
408419
/// protocol conformance.
409420
Synthesized : 1,
@@ -412,10 +423,7 @@ class alignas(1 << DeclAlignInBits) Decl {
412423
HasSingleExpressionBody : 1
413424
);
414425

415-
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+1+2+1+1+2,
416-
/// Whether we've computed the 'static' flag yet.
417-
IsStaticComputed : 1,
418-
426+
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+2+1+1+2,
419427
/// Whether this function is a 'static' method.
420428
IsStatic : 1,
421429

@@ -851,6 +859,17 @@ class alignas(1 << DeclAlignInBits) Decl {
851859
return getValidationState() > ValidationState::Unchecked;
852860
}
853861

862+
/// Manually indicate that validation is complete for the declaration. For
863+
/// example: during importing, code synthesis, or derived conformances.
864+
///
865+
/// For normal code validation, please use DeclValidationRAII instead.
866+
///
867+
/// FIXME -- Everything should use DeclValidationRAII instead of this.
868+
void setValidationToChecked() {
869+
if (!isBeingValidated())
870+
Bits.Decl.ValidationState = unsigned(ValidationState::Checked);
871+
}
872+
854873
bool escapedFromIfConfig() const {
855874
return Bits.Decl.EscapedFromIfConfig;
856875
}
@@ -2591,9 +2610,6 @@ class ValueDecl : public Decl {
25912610
/// if the base declaration is \c open, the override might have to be too.
25922611
bool hasOpenAccess(const DeclContext *useDC) const;
25932612

2594-
/// FIXME: This is deprecated.
2595-
bool isRecursiveValidation() const;
2596-
25972613
/// Retrieve the "interface" type of this value, which uses
25982614
/// GenericTypeParamType if the declaration is generic. For a generic
25992615
/// function, this will have a GenericFunctionType with a
@@ -2753,6 +2769,12 @@ class ValueDecl : public Decl {
27532769
/// Get the representative for this value's opaque result type, if it has one.
27542770
OpaqueReturnTypeRepr *getOpaqueResultTypeRepr() const;
27552771

2772+
/// Set the opaque return type decl for this decl.
2773+
///
2774+
/// `this` must be of a decl type that supports opaque return types, and
2775+
/// must not have previously had an opaque result type set.
2776+
void setOpaqueResultTypeDecl(OpaqueTypeDecl *D);
2777+
27562778
/// Retrieve the attribute associating this declaration with a
27572779
/// function builder, if there is one.
27582780
CustomAttr *getAttachedFunctionBuilder() const;
@@ -4513,6 +4535,10 @@ class AbstractStorageDecl : public ValueDecl {
45134535
Bits.AbstractStorageDecl.IsStatic = IsStatic;
45144536
}
45154537

4538+
void computeIsValidKeyPathComponent();
4539+
4540+
OpaqueTypeDecl *OpaqueReturn = nullptr;
4541+
45164542
public:
45174543

45184544
/// Should this declaration be treated as if annotated with transparent
@@ -4753,9 +4779,18 @@ class AbstractStorageDecl : public ValueDecl {
47534779
/// property from the given module?
47544780
bool isResilient(ModuleDecl *M, ResilienceExpansion expansion) const;
47554781

4782+
void setIsValidKeyPathComponent(bool value) {
4783+
Bits.AbstractStorageDecl.HasComputedValidKeyPathComponent = true;
4784+
Bits.AbstractStorageDecl.ValidKeyPathComponent = value;
4785+
}
4786+
47564787
/// True if the storage can be referenced by a keypath directly.
47574788
/// Otherwise, its override must be referenced.
4758-
bool isValidKeyPathComponent() const;
4789+
bool isValidKeyPathComponent() const {
4790+
if (!Bits.AbstractStorageDecl.HasComputedValidKeyPathComponent)
4791+
const_cast<AbstractStorageDecl *>(this)->computeIsValidKeyPathComponent();
4792+
return Bits.AbstractStorageDecl.ValidKeyPathComponent;
4793+
}
47594794

47604795
/// True if the storage exports a property descriptor for key paths in
47614796
/// other modules.
@@ -4770,6 +4805,14 @@ class AbstractStorageDecl : public ValueDecl {
47704805

47714806
bool hasAnyDynamicReplacementAccessors() const;
47724807

4808+
OpaqueTypeDecl *getOpaqueResultTypeDecl() const {
4809+
return OpaqueReturn;
4810+
}
4811+
void setOpaqueResultTypeDecl(OpaqueTypeDecl *decl) {
4812+
assert(!OpaqueReturn && "already has opaque type decl");
4813+
OpaqueReturn = decl;
4814+
}
4815+
47734816
// Implement isa/cast/dyncast/etc.
47744817
static bool classof(const Decl *D) {
47754818
return D->getKind() >= DeclKind::First_AbstractStorageDecl &&
@@ -5547,8 +5590,6 @@ class ImportAsMemberStatus {
55475590

55485591
/// Base class for function-like declarations.
55495592
class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5550-
friend class NeedsNewVTableEntryRequest;
5551-
55525593
public:
55535594
enum class BodyKind {
55545595
/// The function did not have a body in the source code file.
@@ -5618,11 +5659,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56185659
/// Location of the 'throws' token.
56195660
SourceLoc ThrowsLoc;
56205661

5621-
struct {
5622-
unsigned NeedsNewVTableEntryComputed : 1;
5623-
unsigned NeedsNewVTableEntry : 1;
5624-
} LazySemanticInfo = { };
5625-
56265662
AbstractFunctionDecl(DeclKind Kind, DeclContext *Parent, DeclName Name,
56275663
SourceLoc NameLoc, bool Throws, SourceLoc ThrowsLoc,
56285664
bool HasImplicitSelfDecl,
@@ -5634,6 +5670,8 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56345670
Bits.AbstractFunctionDecl.HasImplicitSelfDecl = HasImplicitSelfDecl;
56355671
Bits.AbstractFunctionDecl.Overridden = false;
56365672
Bits.AbstractFunctionDecl.Throws = Throws;
5673+
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = false;
5674+
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = false;
56375675
Bits.AbstractFunctionDecl.Synthesized = false;
56385676
Bits.AbstractFunctionDecl.HasSingleExpressionBody = false;
56395677
}
@@ -5803,9 +5841,16 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58035841
return getBodyKind() == BodyKind::MemberwiseInitializer;
58045842
}
58055843

5806-
/// For a method of a class, checks whether it will require a new entry in the
5807-
/// vtable.
5808-
bool needsNewVTableEntry() const;
5844+
void setNeedsNewVTableEntry(bool value) {
5845+
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = true;
5846+
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = value;
5847+
}
5848+
5849+
bool needsNewVTableEntry() const {
5850+
if (!Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry)
5851+
const_cast<AbstractFunctionDecl *>(this)->computeNeedsNewVTableEntry();
5852+
return Bits.AbstractFunctionDecl.NeedsNewVTableEntry;
5853+
}
58095854

58105855
bool isEffectiveLinkageMoreVisibleThan(ValueDecl *other) const {
58115856
return (std::min(getEffectiveAccess(), AccessLevel::Public) >
@@ -5947,13 +5992,14 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SelfAccessKind SAK);
59475992
class FuncDecl : public AbstractFunctionDecl {
59485993
friend class AbstractFunctionDecl;
59495994
friend class SelfAccessKindRequest;
5950-
friend class IsStaticRequest;
59515995

59525996
SourceLoc StaticLoc; // Location of the 'static' token or invalid.
59535997
SourceLoc FuncLoc; // Location of the 'func' token.
59545998

59555999
TypeLoc FnRetType;
59566000

6001+
OpaqueTypeDecl *OpaqueReturn = nullptr;
6002+
59576003
protected:
59586004
FuncDecl(DeclKind Kind,
59596005
SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
@@ -5969,14 +6015,14 @@ class FuncDecl : public AbstractFunctionDecl {
59696015
StaticLoc(StaticLoc), FuncLoc(FuncLoc) {
59706016
assert(!Name.getBaseName().isSpecial());
59716017

6018+
Bits.FuncDecl.IsStatic =
6019+
StaticLoc.isValid() || StaticSpelling != StaticSpellingKind::None;
59726020
Bits.FuncDecl.StaticSpelling = static_cast<unsigned>(StaticSpelling);
59736021

59746022
Bits.FuncDecl.ForcedStaticDispatch = false;
59756023
Bits.FuncDecl.SelfAccess =
59766024
static_cast<unsigned>(SelfAccessKind::NonMutating);
59776025
Bits.FuncDecl.SelfAccessComputed = false;
5978-
Bits.FuncDecl.IsStaticComputed = false;
5979-
Bits.FuncDecl.IsStatic = false;
59806026
}
59816027

59826028
private:
@@ -5996,13 +6042,6 @@ class FuncDecl : public AbstractFunctionDecl {
59966042
return None;
59976043
}
59986044

5999-
Optional<bool> getCachedIsStatic() const {
6000-
if (Bits.FuncDecl.IsStaticComputed)
6001-
return Bits.FuncDecl.IsStatic;
6002-
6003-
return None;
6004-
}
6005-
60066045
public:
60076046
/// Factory function only for use by deserialization.
60086047
static FuncDecl *createDeserialized(ASTContext &Context, SourceLoc StaticLoc,
@@ -6025,16 +6064,16 @@ class FuncDecl : public AbstractFunctionDecl {
60256064

60266065
Identifier getName() const { return getFullName().getBaseIdentifier(); }
60276066

6028-
bool isStatic() const;
6029-
6067+
bool isStatic() const {
6068+
return Bits.FuncDecl.IsStatic;
6069+
}
60306070
/// \returns the way 'static'/'class' was spelled in the source.
60316071
StaticSpellingKind getStaticSpelling() const {
60326072
return static_cast<StaticSpellingKind>(Bits.FuncDecl.StaticSpelling);
60336073
}
60346074
/// \returns the way 'static'/'class' should be spelled for this declaration.
60356075
StaticSpellingKind getCorrectStaticSpelling() const;
60366076
void setStatic(bool IsStatic = true) {
6037-
Bits.FuncDecl.IsStaticComputed = true;
60386077
Bits.FuncDecl.IsStatic = IsStatic;
60396078
}
60406079

@@ -6106,7 +6145,15 @@ class FuncDecl : public AbstractFunctionDecl {
61066145
}
61076146

61086147
OperatorDecl *getOperatorDecl() const;
6109-
6148+
6149+
OpaqueTypeDecl *getOpaqueResultTypeDecl() const {
6150+
return OpaqueReturn;
6151+
}
6152+
void setOpaqueResultTypeDecl(OpaqueTypeDecl *decl) {
6153+
assert(!OpaqueReturn && "already has opaque type decl");
6154+
OpaqueReturn = decl;
6155+
}
6156+
61106157
/// Returns true if the function is forced to be statically dispatched.
61116158
bool hasForcedStaticDispatch() const {
61126159
return Bits.FuncDecl.ForcedStaticDispatch;

trunk/include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ ERROR(cannot_convert_argument_value,none,
381381
(Type,Type))
382382

383383
NOTE(candidate_has_invalid_argument_at_position,none,
384-
"candidate expects value of type %0 for parameter #%1",
384+
"candidate expects value of type %0 at position #%1",
385385
(Type, unsigned))
386386

387387
ERROR(cannot_convert_array_to_variadic,none,

trunk/include/swift/AST/FileUnit.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class FileUnit : public DeclContext {
6060

6161
/// Look up an opaque return type by the mangled name of the declaration
6262
/// that defines it.
63-
virtual OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) {
63+
virtual OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName,
64+
LazyResolver *resolver) {
6465
return nullptr;
6566
}
6667

trunk/include/swift/AST/Module.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,8 @@ class ModuleDecl : public DeclContext, public TypeDecl {
354354

355355
/// Look up an opaque return type by the mangled name of the declaration
356356
/// that defines it.
357-
OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName);
357+
OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName,
358+
LazyResolver *resolver);
358359

359360
/// Find ValueDecls in the module and pass them to the given consumer object.
360361
///

0 commit comments

Comments
 (0)