Skip to content

Commit c941876

Browse files
committed
---
yaml --- r: 348851 b: refs/heads/master c: 12c1db9 h: refs/heads/master i: 348849: 54f79a0 348847: 95c0cd2
1 parent c8e0c52 commit c941876

File tree

123 files changed

+1077
-1204
lines changed

Some content is hidden

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

123 files changed

+1077
-1204
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: e7c0172c671e27053a159e9a323ea456ba70cb2c
2+
refs/heads/master: 12c1db9c939fc741c8af719e164b246c564b6f96
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/include/swift/ABI/Metadata.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,8 @@ struct TargetClassMetadata : public TargetAnyClassMetadata<Runtime> {
998998
using StoredPointer = typename Runtime::StoredPointer;
999999
using StoredSize = typename Runtime::StoredSize;
10001000

1001+
friend class ReflectionContext;
1002+
10011003
TargetClassMetadata() = default;
10021004
constexpr TargetClassMetadata(const TargetAnyClassMetadata<Runtime> &base,
10031005
ClassFlags flags,

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: 62 additions & 23 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
@@ -418,10 +423,7 @@ class alignas(1 << DeclAlignInBits) Decl {
418423
HasSingleExpressionBody : 1
419424
);
420425

421-
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+1+2+1+1+2,
422-
/// Whether we've computed the 'static' flag yet.
423-
IsStaticComputed : 1,
424-
426+
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+2+1+1+2,
425427
/// Whether this function is a 'static' method.
426428
IsStatic : 1,
427429

@@ -857,6 +859,17 @@ class alignas(1 << DeclAlignInBits) Decl {
857859
return getValidationState() > ValidationState::Unchecked;
858860
}
859861

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+
860873
bool escapedFromIfConfig() const {
861874
return Bits.Decl.EscapedFromIfConfig;
862875
}
@@ -2597,9 +2610,6 @@ class ValueDecl : public Decl {
25972610
/// if the base declaration is \c open, the override might have to be too.
25982611
bool hasOpenAccess(const DeclContext *useDC) const;
25992612

2600-
/// FIXME: This is deprecated.
2601-
bool isRecursiveValidation() const;
2602-
26032613
/// Retrieve the "interface" type of this value, which uses
26042614
/// GenericTypeParamType if the declaration is generic. For a generic
26052615
/// function, this will have a GenericFunctionType with a
@@ -2759,6 +2769,12 @@ class ValueDecl : public Decl {
27592769
/// Get the representative for this value's opaque result type, if it has one.
27602770
OpaqueReturnTypeRepr *getOpaqueResultTypeRepr() const;
27612771

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+
27622778
/// Retrieve the attribute associating this declaration with a
27632779
/// function builder, if there is one.
27642780
CustomAttr *getAttachedFunctionBuilder() const;
@@ -4519,6 +4535,10 @@ class AbstractStorageDecl : public ValueDecl {
45194535
Bits.AbstractStorageDecl.IsStatic = IsStatic;
45204536
}
45214537

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

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

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

47664795
/// True if the storage exports a property descriptor for key paths in
47674796
/// other modules.
@@ -4776,6 +4805,14 @@ class AbstractStorageDecl : public ValueDecl {
47764805

47774806
bool hasAnyDynamicReplacementAccessors() const;
47784807

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+
47794816
// Implement isa/cast/dyncast/etc.
47804817
static bool classof(const Decl *D) {
47814818
return D->getKind() >= DeclKind::First_AbstractStorageDecl &&
@@ -5955,13 +5992,14 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SelfAccessKind SAK);
59555992
class FuncDecl : public AbstractFunctionDecl {
59565993
friend class AbstractFunctionDecl;
59575994
friend class SelfAccessKindRequest;
5958-
friend class IsStaticRequest;
59595995

59605996
SourceLoc StaticLoc; // Location of the 'static' token or invalid.
59615997
SourceLoc FuncLoc; // Location of the 'func' token.
59625998

59635999
TypeLoc FnRetType;
59646000

6001+
OpaqueTypeDecl *OpaqueReturn = nullptr;
6002+
59656003
protected:
59666004
FuncDecl(DeclKind Kind,
59676005
SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
@@ -5977,14 +6015,14 @@ class FuncDecl : public AbstractFunctionDecl {
59776015
StaticLoc(StaticLoc), FuncLoc(FuncLoc) {
59786016
assert(!Name.getBaseName().isSpecial());
59796017

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

59826022
Bits.FuncDecl.ForcedStaticDispatch = false;
59836023
Bits.FuncDecl.SelfAccess =
59846024
static_cast<unsigned>(SelfAccessKind::NonMutating);
59856025
Bits.FuncDecl.SelfAccessComputed = false;
5986-
Bits.FuncDecl.IsStaticComputed = false;
5987-
Bits.FuncDecl.IsStatic = false;
59886026
}
59896027

59906028
private:
@@ -6004,13 +6042,6 @@ class FuncDecl : public AbstractFunctionDecl {
60046042
return None;
60056043
}
60066044

6007-
Optional<bool> getCachedIsStatic() const {
6008-
if (Bits.FuncDecl.IsStaticComputed)
6009-
return Bits.FuncDecl.IsStatic;
6010-
6011-
return None;
6012-
}
6013-
60146045
public:
60156046
/// Factory function only for use by deserialization.
60166047
static FuncDecl *createDeserialized(ASTContext &Context, SourceLoc StaticLoc,
@@ -6033,16 +6064,16 @@ class FuncDecl : public AbstractFunctionDecl {
60336064

60346065
Identifier getName() const { return getFullName().getBaseIdentifier(); }
60356066

6036-
bool isStatic() const;
6037-
6067+
bool isStatic() const {
6068+
return Bits.FuncDecl.IsStatic;
6069+
}
60386070
/// \returns the way 'static'/'class' was spelled in the source.
60396071
StaticSpellingKind getStaticSpelling() const {
60406072
return static_cast<StaticSpellingKind>(Bits.FuncDecl.StaticSpelling);
60416073
}
60426074
/// \returns the way 'static'/'class' should be spelled for this declaration.
60436075
StaticSpellingKind getCorrectStaticSpelling() const;
60446076
void setStatic(bool IsStatic = true) {
6045-
Bits.FuncDecl.IsStaticComputed = true;
60466077
Bits.FuncDecl.IsStatic = IsStatic;
60476078
}
60486079

@@ -6114,7 +6145,15 @@ class FuncDecl : public AbstractFunctionDecl {
61146145
}
61156146

61166147
OperatorDecl *getOperatorDecl() const;
6117-
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+
61186157
/// Returns true if the function is forced to be statically dispatched.
61196158
bool hasForcedStaticDispatch() const {
61206159
return Bits.FuncDecl.ForcedStaticDispatch;

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
///

trunk/include/swift/AST/SearchPathOptions.h

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#ifndef SWIFT_AST_SEARCHPATHOPTIONS_H
1414
#define SWIFT_AST_SEARCHPATHOPTIONS_H
1515

16-
#include "swift/Basic/ArrayRefView.h"
1716
#include "llvm/ADT/Hashing.h"
1817

1918
#include <string>
@@ -82,38 +81,30 @@ class SearchPathOptions {
8281
/// would for a non-system header.
8382
bool DisableModulesValidateSystemDependencies = false;
8483

85-
private:
86-
static StringRef
87-
pathStringFromFrameworkSearchPath(const FrameworkSearchPath &next) {
88-
return next.Path;
89-
};
90-
91-
public:
9284
/// Return a hash code of any components from these options that should
9385
/// contribute to a Swift Bridging PCH hash.
9486
llvm::hash_code getPCHHashComponents() const {
87+
using llvm::hash_value;
9588
using llvm::hash_combine;
96-
using llvm::hash_combine_range;
97-
98-
using FrameworkPathView = ArrayRefView<FrameworkSearchPath, StringRef,
99-
pathStringFromFrameworkSearchPath>;
100-
FrameworkPathView frameworkPathsOnly{FrameworkSearchPaths};
101-
102-
return hash_combine(SDKPath,
103-
hash_combine_range(ImportSearchPaths.begin(),
104-
ImportSearchPaths.end()),
105-
hash_combine_range(VFSOverlayFiles.begin(),
106-
VFSOverlayFiles.end()),
107-
// FIXME: Should we include the system-ness of framework
108-
// search paths too?
109-
hash_combine_range(frameworkPathsOnly.begin(),
110-
frameworkPathsOnly.end()),
111-
hash_combine_range(LibrarySearchPaths.begin(),
112-
LibrarySearchPaths.end()),
113-
RuntimeResourcePath,
114-
hash_combine_range(RuntimeLibraryImportPaths.begin(),
115-
RuntimeLibraryImportPaths.end()),
116-
DisableModulesValidateSystemDependencies);
89+
auto Code = hash_value(SDKPath);
90+
for (auto Import : ImportSearchPaths) {
91+
Code = hash_combine(Code, Import);
92+
}
93+
for (auto VFSFile : VFSOverlayFiles) {
94+
Code = hash_combine(Code, VFSFile);
95+
}
96+
for (const auto &FrameworkPath : FrameworkSearchPaths) {
97+
Code = hash_combine(Code, FrameworkPath.Path);
98+
}
99+
for (auto LibraryPath : LibrarySearchPaths) {
100+
Code = hash_combine(Code, LibraryPath);
101+
}
102+
Code = hash_combine(Code, RuntimeResourcePath);
103+
for (auto RuntimeLibraryImportPath : RuntimeLibraryImportPaths) {
104+
Code = hash_combine(Code, RuntimeLibraryImportPath);
105+
}
106+
Code = hash_combine(Code, DisableModulesValidateSystemDependencies);
107+
return Code;
117108
}
118109
};
119110

trunk/include/swift/AST/SourceFile.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ class SourceFile final : public FileUnit {
117117
/// The scope map that describes this source file.
118118
std::unique_ptr<ASTScope> Scope;
119119

120-
/// The set of validated opaque return type decls in the source file.
121-
llvm::SmallVector<OpaqueTypeDecl *, 4> OpaqueReturnTypes;
122-
llvm::StringMap<OpaqueTypeDecl *> ValidatedOpaqueReturnTypes;
123-
/// The set of parsed decls with opaque return types that have not yet
124-
/// been validated.
125-
llvm::SetVector<ValueDecl *> UnvalidatedDeclsWithOpaqueReturnTypes;
126-
127120
friend ASTContext;
128121
friend Impl;
129122
public:
@@ -137,6 +130,13 @@ class SourceFile final : public FileUnit {
137130
/// The list of local type declarations in the source file.
138131
llvm::SetVector<TypeDecl *> LocalTypeDecls;
139132

133+
/// The set of validated opaque return type decls in the source file.
134+
llvm::SmallVector<OpaqueTypeDecl *, 4> OpaqueReturnTypes;
135+
llvm::StringMap<OpaqueTypeDecl *> ValidatedOpaqueReturnTypes;
136+
/// The set of parsed decls with opaque return types that have not yet
137+
/// been validated.
138+
llvm::DenseSet<ValueDecl *> UnvalidatedDeclsWithOpaqueReturnTypes;
139+
140140
/// A set of special declaration attributes which require the
141141
/// Foundation module to be imported to work. If the foundation
142142
/// module is still not imported by the time type checking is
@@ -430,13 +430,14 @@ class SourceFile final : public FileUnit {
430430
void setSyntaxRoot(syntax::SourceFileSyntax &&Root);
431431
bool hasSyntaxRoot() const;
432432

433-
OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) override;
433+
OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName,
434+
LazyResolver *resolver) override;
434435

435436
void addUnvalidatedDeclWithOpaqueResultType(ValueDecl *vd) {
436437
UnvalidatedDeclsWithOpaqueReturnTypes.insert(vd);
437438
}
438439

439-
ArrayRef<OpaqueTypeDecl *> getOpaqueReturnTypeDecls();
440+
void markDeclWithOpaqueResultTypeAsValidated(ValueDecl *vd);
440441

441442
private:
442443

0 commit comments

Comments
 (0)