Skip to content

Commit eca457c

Browse files
authored
---
yaml --- r: 348879 b: refs/heads/master c: 98d358c h: refs/heads/master i: 348877: 054fc0f 348875: f6842f4 348871: ac28612 348863: cd5c694
1 parent 64c4237 commit eca457c

File tree

112 files changed

+1202
-1187
lines changed

Some content is hidden

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

112 files changed

+1202
-1187
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: c07d02ef74ec68db7d12bc0a67180b16dd74de9f
2+
refs/heads/master: 98d358cf3b8695f95fb94b0e10c94d8fe97951c4
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: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ 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;
6461

6562
ASTContext &getASTContext() { return Ctx; }
6663
DeclContext *getNotionalDC();

trunk/include/swift/AST/ASTTypeIDZone.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ 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)
3637
SWIFT_TYPEID_NAMED(OperatorDecl *, OperatorDecl)
3738
SWIFT_TYPEID_NAMED(Optional<PropertyWrapperMutability>,
3839
PropertyWrapperMutability)

trunk/include/swift/AST/ASTTypeIDs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class IterableDeclContext;
3434
class ModuleDecl;
3535
class NominalTypeDecl;
3636
class OperatorDecl;
37+
class OpaqueTypeDecl;
3738
class PrecedenceGroupDecl;
3839
struct PropertyWrapperBackingPropertyInfo;
3940
struct PropertyWrapperTypeInfo;

trunk/include/swift/AST/Decl.h

Lines changed: 32 additions & 63 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,7 +412,10 @@ class alignas(1 << DeclAlignInBits) Decl {
418412
HasSingleExpressionBody : 1
419413
);
420414

421-
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+2+1+1+2,
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+
422419
/// Whether this function is a 'static' method.
423420
IsStatic : 1,
424421

@@ -854,17 +851,6 @@ class alignas(1 << DeclAlignInBits) Decl {
854851
return getValidationState() > ValidationState::Unchecked;
855852
}
856853

857-
/// Manually indicate that validation is complete for the declaration. For
858-
/// example: during importing, code synthesis, or derived conformances.
859-
///
860-
/// For normal code validation, please use DeclValidationRAII instead.
861-
///
862-
/// FIXME -- Everything should use DeclValidationRAII instead of this.
863-
void setValidationToChecked() {
864-
if (!isBeingValidated())
865-
Bits.Decl.ValidationState = unsigned(ValidationState::Checked);
866-
}
867-
868854
bool escapedFromIfConfig() const {
869855
return Bits.Decl.EscapedFromIfConfig;
870856
}
@@ -2605,6 +2591,9 @@ class ValueDecl : public Decl {
26052591
/// if the base declaration is \c open, the override might have to be too.
26062592
bool hasOpenAccess(const DeclContext *useDC) const;
26072593

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

2767-
/// Set the opaque return type decl for this decl.
2768-
///
2769-
/// `this` must be of a decl type that supports opaque return types, and
2770-
/// must not have previously had an opaque result type set.
2771-
void setOpaqueResultTypeDecl(OpaqueTypeDecl *D);
2772-
27732756
/// Retrieve the attribute associating this declaration with a
27742757
/// function builder, if there is one.
27752758
CustomAttr *getAttachedFunctionBuilder() const;
@@ -4530,8 +4513,6 @@ class AbstractStorageDecl : public ValueDecl {
45304513
Bits.AbstractStorageDecl.IsStatic = IsStatic;
45314514
}
45324515

4533-
OpaqueTypeDecl *OpaqueReturn = nullptr;
4534-
45354516
public:
45364517

45374518
/// Should this declaration be treated as if annotated with transparent
@@ -4789,14 +4770,6 @@ class AbstractStorageDecl : public ValueDecl {
47894770

47904771
bool hasAnyDynamicReplacementAccessors() const;
47914772

4792-
OpaqueTypeDecl *getOpaqueResultTypeDecl() const {
4793-
return OpaqueReturn;
4794-
}
4795-
void setOpaqueResultTypeDecl(OpaqueTypeDecl *decl) {
4796-
assert(!OpaqueReturn && "already has opaque type decl");
4797-
OpaqueReturn = decl;
4798-
}
4799-
48004773
// Implement isa/cast/dyncast/etc.
48014774
static bool classof(const Decl *D) {
48024775
return D->getKind() >= DeclKind::First_AbstractStorageDecl &&
@@ -5574,6 +5547,8 @@ class ImportAsMemberStatus {
55745547

55755548
/// Base class for function-like declarations.
55765549
class AbstractFunctionDecl : public GenericContext, public ValueDecl {
5550+
friend class NeedsNewVTableEntryRequest;
5551+
55775552
public:
55785553
enum class BodyKind {
55795554
/// The function did not have a body in the source code file.
@@ -5643,6 +5618,11 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56435618
/// Location of the 'throws' token.
56445619
SourceLoc ThrowsLoc;
56455620

5621+
struct {
5622+
unsigned NeedsNewVTableEntryComputed : 1;
5623+
unsigned NeedsNewVTableEntry : 1;
5624+
} LazySemanticInfo = { };
5625+
56465626
AbstractFunctionDecl(DeclKind Kind, DeclContext *Parent, DeclName Name,
56475627
SourceLoc NameLoc, bool Throws, SourceLoc ThrowsLoc,
56485628
bool HasImplicitSelfDecl,
@@ -5654,8 +5634,6 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
56545634
Bits.AbstractFunctionDecl.HasImplicitSelfDecl = HasImplicitSelfDecl;
56555635
Bits.AbstractFunctionDecl.Overridden = false;
56565636
Bits.AbstractFunctionDecl.Throws = Throws;
5657-
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = false;
5658-
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = false;
56595637
Bits.AbstractFunctionDecl.Synthesized = false;
56605638
Bits.AbstractFunctionDecl.HasSingleExpressionBody = false;
56615639
}
@@ -5825,16 +5803,9 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
58255803
return getBodyKind() == BodyKind::MemberwiseInitializer;
58265804
}
58275805

5828-
void setNeedsNewVTableEntry(bool value) {
5829-
Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry = true;
5830-
Bits.AbstractFunctionDecl.NeedsNewVTableEntry = value;
5831-
}
5832-
5833-
bool needsNewVTableEntry() const {
5834-
if (!Bits.AbstractFunctionDecl.HasComputedNeedsNewVTableEntry)
5835-
const_cast<AbstractFunctionDecl *>(this)->computeNeedsNewVTableEntry();
5836-
return Bits.AbstractFunctionDecl.NeedsNewVTableEntry;
5837-
}
5806+
/// For a method of a class, checks whether it will require a new entry in the
5807+
/// vtable.
5808+
bool needsNewVTableEntry() const;
58385809

58395810
bool isEffectiveLinkageMoreVisibleThan(ValueDecl *other) const {
58405811
return (std::min(getEffectiveAccess(), AccessLevel::Public) >
@@ -5976,14 +5947,13 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SelfAccessKind SAK);
59765947
class FuncDecl : public AbstractFunctionDecl {
59775948
friend class AbstractFunctionDecl;
59785949
friend class SelfAccessKindRequest;
5950+
friend class IsStaticRequest;
59795951

59805952
SourceLoc StaticLoc; // Location of the 'static' token or invalid.
59815953
SourceLoc FuncLoc; // Location of the 'func' token.
59825954

59835955
TypeLoc FnRetType;
59845956

5985-
OpaqueTypeDecl *OpaqueReturn = nullptr;
5986-
59875957
protected:
59885958
FuncDecl(DeclKind Kind,
59895959
SourceLoc StaticLoc, StaticSpellingKind StaticSpelling,
@@ -5999,14 +5969,14 @@ class FuncDecl : public AbstractFunctionDecl {
59995969
StaticLoc(StaticLoc), FuncLoc(FuncLoc) {
60005970
assert(!Name.getBaseName().isSpecial());
60015971

6002-
Bits.FuncDecl.IsStatic =
6003-
StaticLoc.isValid() || StaticSpelling != StaticSpellingKind::None;
60045972
Bits.FuncDecl.StaticSpelling = static_cast<unsigned>(StaticSpelling);
60055973

60065974
Bits.FuncDecl.ForcedStaticDispatch = false;
60075975
Bits.FuncDecl.SelfAccess =
60085976
static_cast<unsigned>(SelfAccessKind::NonMutating);
60095977
Bits.FuncDecl.SelfAccessComputed = false;
5978+
Bits.FuncDecl.IsStaticComputed = false;
5979+
Bits.FuncDecl.IsStatic = false;
60105980
}
60115981

60125982
private:
@@ -6026,6 +5996,13 @@ class FuncDecl : public AbstractFunctionDecl {
60265996
return None;
60275997
}
60285998

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

60496026
Identifier getName() const { return getFullName().getBaseIdentifier(); }
60506027

6051-
bool isStatic() const {
6052-
return Bits.FuncDecl.IsStatic;
6053-
}
6028+
bool isStatic() const;
6029+
60546030
/// \returns the way 'static'/'class' was spelled in the source.
60556031
StaticSpellingKind getStaticSpelling() const {
60566032
return static_cast<StaticSpellingKind>(Bits.FuncDecl.StaticSpelling);
60576033
}
60586034
/// \returns the way 'static'/'class' should be spelled for this declaration.
60596035
StaticSpellingKind getCorrectStaticSpelling() const;
60606036
void setStatic(bool IsStatic = true) {
6037+
Bits.FuncDecl.IsStaticComputed = true;
60616038
Bits.FuncDecl.IsStatic = IsStatic;
60626039
}
60636040

@@ -6129,15 +6106,7 @@ class FuncDecl : public AbstractFunctionDecl {
61296106
}
61306107

61316108
OperatorDecl *getOperatorDecl() const;
6132-
6133-
OpaqueTypeDecl *getOpaqueResultTypeDecl() const {
6134-
return OpaqueReturn;
6135-
}
6136-
void setOpaqueResultTypeDecl(OpaqueTypeDecl *decl) {
6137-
assert(!OpaqueReturn && "already has opaque type decl");
6138-
OpaqueReturn = decl;
6139-
}
6140-
6109+
61416110
/// Returns true if the function is forced to be statically dispatched.
61426111
bool hasForcedStaticDispatch() const {
61436112
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 at position #%1",
384+
"candidate expects value of type %0 for parameter #%1",
385385
(Type, unsigned))
386386

387387
ERROR(cannot_convert_array_to_variadic,none,

trunk/include/swift/AST/FileUnit.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ 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,
64-
LazyResolver *resolver) {
63+
virtual OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName) {
6564
return nullptr;
6665
}
6766

trunk/include/swift/AST/Module.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,7 @@ 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,
358-
LazyResolver *resolver);
357+
OpaqueTypeDecl *lookupOpaqueResultType(StringRef MangledName);
359358

360359
/// Find ValueDecls in the module and pass them to the given consumer object.
361360
///

trunk/include/swift/AST/SourceFile.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ 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+
120127
friend ASTContext;
121128
friend Impl;
122129
public:
@@ -130,13 +137,6 @@ class SourceFile final : public FileUnit {
130137
/// The list of local type declarations in the source file.
131138
llvm::SetVector<TypeDecl *> LocalTypeDecls;
132139

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,14 +430,13 @@ class SourceFile final : public FileUnit {
430430
void setSyntaxRoot(syntax::SourceFileSyntax &&Root);
431431
bool hasSyntaxRoot() const;
432432

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

436435
void addUnvalidatedDeclWithOpaqueResultType(ValueDecl *vd) {
437436
UnvalidatedDeclsWithOpaqueReturnTypes.insert(vd);
438437
}
439438

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

442441
private:
443442

0 commit comments

Comments
 (0)