Skip to content

Commit bdfee1f

Browse files
committed
---
yaml --- r: 348860 b: refs/heads/master c: c1a1ddd h: refs/heads/master
1 parent befb8a3 commit bdfee1f

File tree

96 files changed

+997
-1142
lines changed

Some content is hidden

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

96 files changed

+997
-1142
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: 5b878ac8f8be1990fd08015b0a77f3dc4a159ec7
2+
refs/heads/master: c1a1ddd458032a12f3be543314e7f9767f11aba3
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/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: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class alignas(1 << DeclAlignInBits) Decl {
388388
SWIFT_INLINE_BITFIELD(SubscriptDecl, VarDecl, 2,
389389
StaticSpelling : 2
390390
);
391-
SWIFT_INLINE_BITFIELD(AbstractFunctionDecl, ValueDecl, 3+8+1+1+1+1+1+1+1+1,
391+
SWIFT_INLINE_BITFIELD(AbstractFunctionDecl, ValueDecl, 3+8+1+1+1+1+1+1,
392392
/// \see AbstractFunctionDecl::BodyKind
393393
BodyKind : 3,
394394

@@ -404,12 +404,6 @@ class alignas(1 << DeclAlignInBits) Decl {
404404
/// Whether the function body throws.
405405
Throws : 1,
406406

407-
/// Whether this function requires a new vtable entry.
408-
NeedsNewVTableEntry : 1,
409-
410-
/// Whether NeedsNewVTableEntry is valid.
411-
HasComputedNeedsNewVTableEntry : 1,
412-
413407
/// Whether this member was synthesized as part of a derived
414408
/// protocol conformance.
415409
Synthesized : 1,
@@ -418,10 +412,7 @@ class alignas(1 << DeclAlignInBits) Decl {
418412
HasSingleExpressionBody : 1
419413
);
420414

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-
415+
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+2+1+1+2,
425416
/// Whether this function is a 'static' method.
426417
IsStatic : 1,
427418

@@ -857,6 +848,17 @@ class alignas(1 << DeclAlignInBits) Decl {
857848
return getValidationState() > ValidationState::Unchecked;
858849
}
859850

851+
/// Manually indicate that validation is complete for the declaration. For
852+
/// example: during importing, code synthesis, or derived conformances.
853+
///
854+
/// For normal code validation, please use DeclValidationRAII instead.
855+
///
856+
/// FIXME -- Everything should use DeclValidationRAII instead of this.
857+
void setValidationToChecked() {
858+
if (!isBeingValidated())
859+
Bits.Decl.ValidationState = unsigned(ValidationState::Checked);
860+
}
861+
860862
bool escapedFromIfConfig() const {
861863
return Bits.Decl.EscapedFromIfConfig;
862864
}
@@ -2597,9 +2599,6 @@ class ValueDecl : public Decl {
25972599
/// if the base declaration is \c open, the override might have to be too.
25982600
bool hasOpenAccess(const DeclContext *useDC) const;
25992601

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

2761+
/// Set the opaque return type decl for this decl.
2762+
///
2763+
/// `this` must be of a decl type that supports opaque return types, and
2764+
/// must not have previously had an opaque result type set.
2765+
void setOpaqueResultTypeDecl(OpaqueTypeDecl *D);
2766+
27622767
/// Retrieve the attribute associating this declaration with a
27632768
/// function builder, if there is one.
27642769
CustomAttr *getAttachedFunctionBuilder() const;
@@ -4519,6 +4524,8 @@ class AbstractStorageDecl : public ValueDecl {
45194524
Bits.AbstractStorageDecl.IsStatic = IsStatic;
45204525
}
45214526

4527+
OpaqueTypeDecl *OpaqueReturn = nullptr;
4528+
45224529
public:
45234530

45244531
/// Should this declaration be treated as if annotated with transparent
@@ -4776,6 +4783,14 @@ class AbstractStorageDecl : public ValueDecl {
47764783

47774784
bool hasAnyDynamicReplacementAccessors() const;
47784785

4786+
OpaqueTypeDecl *getOpaqueResultTypeDecl() const {
4787+
return OpaqueReturn;
4788+
}
4789+
void setOpaqueResultTypeDecl(OpaqueTypeDecl *decl) {
4790+
assert(!OpaqueReturn && "already has opaque type decl");
4791+
OpaqueReturn = decl;
4792+
}
4793+
47794794
// Implement isa/cast/dyncast/etc.
47804795
static bool classof(const Decl *D) {
47814796
return D->getKind() >= DeclKind::First_AbstractStorageDecl &&
@@ -5553,6 +5568,8 @@ class ImportAsMemberStatus {
55535568

55545569
/// Base class for function-like declarations.
55555570
class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5571+
friend class NeedsNewVTableEntryRequest;
5572+
55565573
public:
55575574
enum class BodyKind {
55585575
/// The function did not have a body in the source code file.
@@ -5622,6 +5639,11 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56225639
/// Location of the 'throws' token.
56235640
SourceLoc ThrowsLoc;
56245641

5642+
struct {
5643+
unsigned NeedsNewVTableEntryComputed : 1;
5644+
unsigned NeedsNewVTableEntry : 1;
5645+
} LazySemanticInfo = { };
5646+
56255647
AbstractFunctionDecl(DeclKind Kind, DeclContext *Parent, DeclName Name,
56265648
SourceLoc NameLoc, bool Throws, SourceLoc ThrowsLoc,
56275649
bool HasImplicitSelfDecl,
@@ -5633,8 +5655,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56335655
Bits.AbstractFunctionDecl.HasImplicitSelfDecl = HasImplicitSelfDecl;
56345656
Bits.AbstractFunctionDecl.Overridden = false;
56355657
Bits.AbstractFunctionDecl.Throws = Throws;
5636-
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = false;
5637-
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = false;
56385658
Bits.AbstractFunctionDecl.Synthesized = false;
56395659
Bits.AbstractFunctionDecl.HasSingleExpressionBody = false;
56405660
}
@@ -5805,15 +5825,13 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58055825
}
58065826

58075827
void setNeedsNewVTableEntry(bool value) {
5808-
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = true;
5809-
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = value;
5828+
LazySemanticInfo.NeedsNewVTableEntryComputed = true;
5829+
LazySemanticInfo.NeedsNewVTableEntry = value;
58105830
}
58115831

5812-
bool needsNewVTableEntry() const {
5813-
if (!Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry)
5814-
const_cast<AbstractFunctionDecl *>(this)->computeNeedsNewVTableEntry();
5815-
return Bits.AbstractFunctionDecl.NeedsNewVTableEntry;
5816-
}
5832+
/// For a method of a class, checks whether it will require a new entry in the
5833+
/// vtable.
5834+
bool needsNewVTableEntry() const;
58175835

58185836
bool isEffectiveLinkageMoreVisibleThan(ValueDecl *other) const {
58195837
return (std::min(getEffectiveAccess(), AccessLevel::Public) >
@@ -5955,13 +5973,14 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SelfAccessKind SAK);
59555973
class FuncDecl : public AbstractFunctionDecl {
59565974
friend class AbstractFunctionDecl;
59575975
friend class SelfAccessKindRequest;
5958-
friend class IsStaticRequest;
59595976

59605977
SourceLoc StaticLoc; // Location of the 'static' token or invalid.
59615978
SourceLoc FuncLoc; // Location of the 'func' token.
59625979

59635980
TypeLoc FnRetType;
59645981

5982+
OpaqueTypeDecl *OpaqueReturn = nullptr;
5983+
59655984
protected:
59665985
FuncDecl(DeclKind Kind,
59675986
SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
@@ -5977,14 +5996,14 @@ class FuncDecl : public AbstractFunctionDecl {
59775996
StaticLoc(StaticLoc), FuncLoc(FuncLoc) {
59785997
assert(!Name.getBaseName().isSpecial());
59795998

5999+
Bits.FuncDecl.IsStatic =
6000+
StaticLoc.isValid() || StaticSpelling != StaticSpellingKind::None;
59806001
Bits.FuncDecl.StaticSpelling = static_cast<unsigned>(StaticSpelling);
59816002

59826003
Bits.FuncDecl.ForcedStaticDispatch = false;
59836004
Bits.FuncDecl.SelfAccess =
59846005
static_cast<unsigned>(SelfAccessKind::NonMutating);
59856006
Bits.FuncDecl.SelfAccessComputed = false;
5986-
Bits.FuncDecl.IsStaticComputed = false;
5987-
Bits.FuncDecl.IsStatic = false;
59886007
}
59896008

59906009
private:
@@ -6004,13 +6023,6 @@ class FuncDecl : public AbstractFunctionDecl {
60046023
return None;
60056024
}
60066025

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

60346046
Identifier getName() const { return getFullName().getBaseIdentifier(); }
60356047

6036-
bool isStatic() const;
6037-
6048+
bool isStatic() const {
6049+
return Bits.FuncDecl.IsStatic;
6050+
}
60386051
/// \returns the way 'static'/'class' was spelled in the source.
60396052
StaticSpellingKind getStaticSpelling() const {
60406053
return static_cast<StaticSpellingKind>(Bits.FuncDecl.StaticSpelling);
60416054
}
60426055
/// \returns the way 'static'/'class' should be spelled for this declaration.
60436056
StaticSpellingKind getCorrectStaticSpelling() const;
60446057
void setStatic(bool IsStatic = true) {
6045-
Bits.FuncDecl.IsStaticComputed = true;
60466058
Bits.FuncDecl.IsStatic = IsStatic;
60476059
}
60486060

@@ -6114,7 +6126,15 @@ class FuncDecl : public AbstractFunctionDecl {
61146126
}
61156127

61166128
OperatorDecl *getOperatorDecl() const;
6117-
6129+
6130+
OpaqueTypeDecl *getOpaqueResultTypeDecl() const {
6131+
return OpaqueReturn;
6132+
}
6133+
void setOpaqueResultTypeDecl(OpaqueTypeDecl *decl) {
6134+
assert(!OpaqueReturn && "already has opaque type decl");
6135+
OpaqueReturn = decl;
6136+
}
6137+
61186138
/// Returns true if the function is forced to be statically dispatched.
61196139
bool hasForcedStaticDispatch() const {
61206140
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
///

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

0 commit comments

Comments
 (0)