Skip to content

Commit cd606e1

Browse files
committed
---
yaml --- r: 341231 b: refs/heads/rxwei-patch-1 c: 34aace6 h: refs/heads/master i: 341229: eae0b26 341227: 0ccff8d 341223: 5428dae 341215: e143fb3
1 parent 303793b commit cd606e1

File tree

171 files changed

+36536
-97670
lines changed

Some content is hidden

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

171 files changed

+36536
-97670
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: 1fa5a6786025b69338ed7b93cb52c6675a0889b5
1018+
refs/heads/rxwei-patch-1: 34aace6b4375e5905f13510ba2044f97f339f079
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/include/swift/AST/ASTPrinter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ namespace swift {
3636
class ValueDecl;
3737
class SourceLoc;
3838
enum class tok;
39-
enum class AccessorKind;
4039

4140
/// Describes the context in which a name is being printed, which
4241
/// affects the keywords that need to be escaped.
@@ -340,7 +339,6 @@ void printEnumElementsAsCases(
340339
void getInheritedForPrinting(const Decl *decl, const PrintOptions &options,
341340
llvm::SmallVectorImpl<TypeLoc> &Results);
342341

343-
StringRef getAccessorKindString(AccessorKind value);
344342
} // namespace swift
345343

346344
#endif // LLVM_SWIFT_AST_ASTPRINTER_H

branches/rxwei-patch-1/include/swift/AST/ASTScope.h

Lines changed: 107 additions & 126 deletions
Large diffs are not rendered by default.

branches/rxwei-patch-1/include/swift/AST/AnyFunctionRef.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,6 @@ class AnyFunctionRef {
116116
return TheFunction.dyn_cast<AbstractClosureExpr*>();
117117
}
118118

119-
bool isDeferBody() const {
120-
if (auto *fd = dyn_cast_or_null<FuncDecl>(getAbstractFunctionDecl()))
121-
return fd->isDeferBody();
122-
return false;
123-
}
124-
125119
/// Return true if this closure is passed as an argument to a function and is
126120
/// known not to escape from that function. In this case, captures can be
127121
/// more efficient.

branches/rxwei-patch-1/include/swift/AST/CaptureInfo.h

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#define SWIFT_AST_CAPTURE_INFO_H
1515

1616
#include "swift/Basic/LLVM.h"
17-
#include "swift/Basic/SourceLoc.h"
1817
#include "swift/AST/TypeAlignments.h"
1918
#include "llvm/ADT/ArrayRef.h"
2019
#include "llvm/ADT/PointerIntPair.h"
@@ -45,9 +44,8 @@ class CapturedValue {
4544

4645
private:
4746
Storage Value;
48-
SourceLoc Loc;
4947

50-
explicit CapturedValue(Storage V, SourceLoc Loc) : Value(V), Loc(Loc) {}
48+
explicit CapturedValue(Storage V) : Value(V) {}
5149

5250
public:
5351
friend struct llvm::DenseMapInfo<CapturedValue>;
@@ -63,14 +61,12 @@ class CapturedValue {
6361
IsNoEscape = 1 << 1
6462
};
6563

66-
CapturedValue(ValueDecl *Val, unsigned Flags, SourceLoc Loc)
67-
: Value(Val, Flags), Loc(Loc) {}
68-
69-
CapturedValue(OpaqueValueExpr *Val, unsigned Flags)
70-
: Value(Val, Flags), Loc(SourceLoc()) {}
64+
CapturedValue(llvm::PointerUnion<ValueDecl*, OpaqueValueExpr*> Ptr,
65+
unsigned Flags)
66+
: Value(Ptr, Flags) {}
7167

7268
static CapturedValue getDynamicSelfMetadata() {
73-
return CapturedValue((ValueDecl *)nullptr, 0, SourceLoc());
69+
return CapturedValue((ValueDecl *)nullptr, 0);
7470
}
7571

7672
bool isDirect() const { return Value.getInt() & IsDirect; }
@@ -84,9 +80,7 @@ class CapturedValue {
8480
CapturedValue mergeFlags(CapturedValue cv) {
8581
assert(Value.getPointer() == cv.Value.getPointer() &&
8682
"merging flags on two different value decls");
87-
return CapturedValue(
88-
Storage(Value.getPointer(), getFlags() & cv.getFlags()),
89-
Loc);
83+
return CapturedValue(Value.getPointer(), getFlags() & cv.getFlags());
9084
}
9185

9286
ValueDecl *getDecl() const {
@@ -101,13 +95,49 @@ class CapturedValue {
10195
return Value.getPointer().dyn_cast<OpaqueValueExpr *>();
10296
}
10397

104-
SourceLoc getLoc() const { return Loc; }
105-
10698
unsigned getFlags() const { return Value.getInt(); }
99+
100+
bool operator==(CapturedValue RHS) const {
101+
return Value == RHS.Value;
102+
}
103+
104+
bool operator!=(CapturedValue RHS) const {
105+
return Value != RHS.Value;
106+
}
107+
108+
bool operator<(CapturedValue RHS) const {
109+
return Value < RHS.Value;
110+
}
107111
};
108112

109113
} // end swift namespace
110114

115+
namespace llvm {
116+
117+
template <> struct DenseMapInfo<swift::CapturedValue> {
118+
using CapturedValue = swift::CapturedValue;
119+
120+
using PtrIntPairDenseMapInfo = DenseMapInfo<CapturedValue::Storage>;
121+
122+
static inline swift::CapturedValue getEmptyKey() {
123+
return CapturedValue{PtrIntPairDenseMapInfo::getEmptyKey()};
124+
}
125+
126+
static inline CapturedValue getTombstoneKey() {
127+
return CapturedValue{PtrIntPairDenseMapInfo::getTombstoneKey()};
128+
}
129+
130+
static unsigned getHashValue(const CapturedValue &Val) {
131+
return PtrIntPairDenseMapInfo::getHashValue(Val.Value);
132+
}
133+
134+
static bool isEqual(const CapturedValue &LHS, const CapturedValue &RHS) {
135+
return PtrIntPairDenseMapInfo::isEqual(LHS.Value, RHS.Value);
136+
}
137+
};
138+
139+
} // end llvm namespace
140+
111141
namespace swift {
112142

113143
class DynamicSelfType;

branches/rxwei-patch-1/include/swift/AST/DiagnosticsCommon.def

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ ERROR(sdk_node_unrecognized_decl_attr_kind,none,
132132
"unrecognized declaration attribute '%0' in SDK node", (StringRef))
133133
ERROR(sdk_node_unrecognized_decl_kind,none,
134134
"unrecognized declaration kind '%0' in SDK node", (StringRef))
135-
ERROR(sdk_node_unrecognized_accessor_kind,none,
136-
"unrecognized accessor kind '%0' in SDK node", (StringRef))
137135

138136
//------------------------------------------------------------------------------
139137
// MARK: Circular reference diagnostics

branches/rxwei-patch-1/include/swift/AST/DiagnosticsModuleDiffer.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ ERROR(raw_type_change,none,"%0(%1) is now %2 representable", (StringRef, StringR
4242

4343
ERROR(removed_decl,none,"%0 has been removed%select{| (deprecated)}1", (StringRef, bool))
4444

45+
ERROR(removed_setter,none,"%0 has removed its setter", (StringRef))
46+
4547
ERROR(moved_decl,none,"%0 has been moved to %1", (StringRef, StringRef))
4648

4749
ERROR(renamed_decl,none,"%0 has been renamed to %1", (StringRef, StringRef))

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSIL.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,6 @@ ERROR(unsupported_c_function_pointer_conversion,none,
116116
ERROR(objc_selector_malformed,none,"the type ObjectiveC.Selector is malformed",
117117
())
118118

119-
// Capture before declaration diagnostics.
120-
ERROR(capture_before_declaration,none,
121-
"closure captures %0 before it is declared", (Identifier))
122-
ERROR(capture_before_declaration_defer,none,
123-
"'defer' block captures %0 before it is declared", (Identifier))
124-
NOTE(captured_value_declared_here,none,
125-
"captured value declared here", ())
126-
127119
// Invalid escaping capture diagnostics.
128120
ERROR(escaping_inout_capture,none,
129121
"escaping closure captures 'inout' parameter %0", (Identifier))

branches/rxwei-patch-1/include/swift/AST/DiagnosticsSema.def

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3016,6 +3016,14 @@ ERROR(method_call_in_closure_without_explicit_self,none,
30163016
ERROR(implicit_use_of_self_in_closure,none,
30173017
"implicit use of 'self' in closure; use 'self.' to make"
30183018
" capture semantics explicit", ())
3019+
ERROR(capture_before_declaration,none,
3020+
"cannot capture %0 before it is declared", (Identifier))
3021+
ERROR(transitive_capture_before_declaration,none,
3022+
"cannot capture %0, which would use %1 before it is declared",
3023+
(Identifier, Identifier))
3024+
NOTE(transitive_capture_through_here,none,
3025+
"%0, declared here, captures %1",
3026+
(Identifier, Identifier))
30193027

30203028
WARNING(recursive_accessor_reference,none,
30213029
"attempting to %select{access|modify}1 %0 within its own "

branches/rxwei-patch-1/include/swift/AST/NameLookup.h

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -592,18 +592,17 @@ class AbstractASTScopeDeclConsumer {
592592
/// Takes an array in order to batch the consumption before setting
593593
/// IndexOfFirstOuterResult when necessary.
594594
virtual bool consume(ArrayRef<ValueDecl *> values, DeclVisibilityKind vis,
595+
Optional<bool> isCascadingUse,
595596
NullablePtr<DeclContext> baseDC = nullptr) = 0;
596597

597598
/// Eventually this functionality should move into ASTScopeLookup
598-
virtual bool
599-
lookInMembers(NullablePtr<DeclContext> selfDC, DeclContext *const scopeDC,
600-
NominalTypeDecl *const nominal,
601-
function_ref<bool(Optional<bool>)> calculateIsCascadingUse) = 0;
599+
virtual std::pair<bool, Optional<bool>>
600+
lookupInSelfType(NullablePtr<DeclContext> selfDC, DeclContext *const scopeDC,
601+
NominalTypeDecl *const nominal,
602+
Optional<bool> isCascadingUse) = 0;
602603

603604
#ifndef NDEBUG
604-
virtual void startingNextLookupStep() = 0;
605-
virtual void finishingLookup(std::string) const = 0;
606-
virtual bool isTargetLookup() const = 0;
605+
virtual void stopForDebuggingIfTargetLookup() = 0;
607606
#endif
608607
};
609608

@@ -616,19 +615,19 @@ class ASTScopeDeclGatherer : public AbstractASTScopeDeclConsumer {
616615
virtual ~ASTScopeDeclGatherer() = default;
617616

618617
bool consume(ArrayRef<ValueDecl *> values, DeclVisibilityKind vis,
618+
Optional<bool> isCascadingUse,
619619
NullablePtr<DeclContext> baseDC = nullptr) override;
620620

621621
/// Eventually this functionality should move into ASTScopeLookup
622-
bool lookInMembers(NullablePtr<DeclContext>, DeclContext *const,
623-
NominalTypeDecl *const,
624-
function_ref<bool(Optional<bool>)>) override {
625-
return false;
622+
std::pair<bool, Optional<bool>>
623+
lookupInSelfType(NullablePtr<DeclContext>, DeclContext *const,
624+
NominalTypeDecl *const,
625+
Optional<bool> isCascadingUse) override {
626+
return std::make_pair(false, isCascadingUse);
626627
}
627628

628629
#ifndef NDEBUG
629-
void startingNextLookupStep() override {}
630-
void finishingLookup(std::string) const override {}
631-
bool isTargetLookup() const override { return false; }
630+
void stopForDebuggingIfTargetLookup() override {}
632631
#endif
633632

634633
ArrayRef<ValueDecl *> getDecls() { return values; }
@@ -642,17 +641,12 @@ class ASTScope {
642641

643642
public:
644643
ASTScope(SourceFile *);
645-
646-
/// \return the scopes traversed
647-
static llvm::SmallVector<const ast_scope::ASTScopeImpl *, 0>
644+
static Optional<bool>
648645
unqualifiedLookup(SourceFile *, DeclName, SourceLoc,
649646
const DeclContext *startingContext,
647+
Optional<bool> isCascadingUse,
650648
namelookup::AbstractASTScopeDeclConsumer &);
651649

652-
static Optional<bool>
653-
computeIsCascadingUse(ArrayRef<const ast_scope::ASTScopeImpl *> history,
654-
Optional<bool> initialIsCascadingUse);
655-
656650
LLVM_ATTRIBUTE_DEPRECATED(void dump() const LLVM_ATTRIBUTE_USED,
657651
"only for use within the debugger");
658652
void print(llvm::raw_ostream &) const;

branches/rxwei-patch-1/include/swift/AST/Types.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,10 @@ class alignas(1 << TypeAlignInBits) TypeBase {
585585
/// existential type throughout the given type.
586586
Type eraseOpenedExistential(OpenedArchetypeType *opened);
587587

588+
/// Erase DynamicSelfType from the given type by replacing it with its
589+
/// underlying type.
590+
Type eraseDynamicSelfType();
591+
588592
/// Given a declaration context, returns a function type with the 'self'
589593
/// type curried as the input if the declaration context describes a type.
590594
/// Otherwise, returns the type itself.

branches/rxwei-patch-1/include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,8 @@ namespace swift {
247247
bool EnableDeserializationRecovery = true;
248248

249249
/// Should we use \c ASTScope-based resolution for unqualified name lookup?
250-
/// Default is in \c ParseLangArgs
251-
///
252-
/// This is a staging flag; eventually it will be removed.
253250
bool EnableASTScopeLookup = false;
254-
251+
255252
/// Someday, ASTScopeLookup will supplant lookup in the parser
256253
bool DisableParserLookup = false;
257254

branches/rxwei-patch-1/include/swift/IDE/DigesterEnums.def

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ NODE_KIND_RANGE(Type, TypeNominal, TypeAlias)
6464

6565
NODE_KIND(DeclFunction, Function)
6666
NODE_KIND(DeclConstructor, Constructor)
67-
NODE_KIND(DeclAccessor, Accessor)
67+
NODE_KIND(DeclGetter, Getter)
68+
NODE_KIND(DeclSetter, Setter)
6869
NODE_KIND(DeclSubscript, Subscript)
6970
NODE_KIND_RANGE(DeclAbstractFunc, DeclFunction, DeclSubscript)
7071

@@ -125,10 +126,13 @@ KEY_BOOL(IsDeprecated, deprecated)
125126
KEY_BOOL(IsOverriding, overriding)
126127
KEY_BOOL(IsProtocolReq, protocolReq)
127128
KEY_BOOL(HasDefaultArg, hasDefaultArg)
129+
KEY_BOOL(HasSetter, hasSetter)
128130
KEY_BOOL(IsLet, isLet)
129131
KEY_BOOL(IsOpen, isOpen)
130132
KEY_BOOL(IsInternal, isInternal)
131133
KEY_BOOL(HasStorage, hasStorage)
134+
KEY_BOOL(HasDidset, hasDidset)
135+
KEY_BOOL(HasWillset, hasWillset)
132136
KEY_BOOL(ReqNewWitnessTableEntry, reqNewWitnessTableEntry)
133137
KEY_BOOL(IsABIPlaceholder, isABIPlaceholder)
134138
KEY_BOOL(IsExternal, isExternal)
@@ -162,8 +166,6 @@ KEY(typeAttributes)
162166
KEY(declAttributes)
163167
KEY(declKind)
164168
KEY(ownership)
165-
KEY(accessors)
166-
KEY(accessorKind)
167169

168170
KNOWN_TYPE(Optional)
169171
KNOWN_TYPE(ImplicitlyUnwrappedOptional)

branches/rxwei-patch-1/include/swift/Option/Options.td

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -869,12 +869,7 @@ def enable_astscope_lookup : Flag<["-"], "enable-astscope-lookup">,
869869
Flags<[FrontendOption]>,
870870
HelpText<"Enable ASTScope-based unqualified name lookup">;
871871

872-
def disable_astscope_lookup : Flag<["-"], "disable-astscope-lookup">,
873-
Flags<[FrontendOption]>,
874-
HelpText<"Disable ASTScope-based unqualified name lookup">;
875-
876-
def disable_parser_lookup : Flag<["-"], "disable-parser-lookup">,
877-
Flags<[FrontendOption]>,
872+
def disable_parser_lookup : Flag<["-"], "disable_parser_lookup">,
878873
HelpText<"Disable parser lookup & use ast scope lookup only (experimental)">;
879874

880875
def index_file : Flag<["-"], "index-file">,

branches/rxwei-patch-1/include/swift/SIL/TypeLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,8 @@ struct SILConstantInfo {
568568

569569
/// Different ways in which a function can capture context.
570570
enum class CaptureKind {
571+
/// No context arguments are necessary.
572+
None,
571573
/// A local value captured as a mutable box.
572574
Box,
573575
/// A local value captured as a single pointer to storage (formed with

branches/rxwei-patch-1/lib/AST/ASTDumper.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ static StringRef getDefaultArgumentKindString(DefaultArgumentKind value) {
310310

311311
llvm_unreachable("Unhandled DefaultArgumentKind in switch.");
312312
}
313+
static StringRef getAccessorKindString(AccessorKind value) {
314+
switch (value) {
315+
#define ACCESSOR(ID)
316+
#define SINGLETON_ACCESSOR(ID, KEYWORD) \
317+
case AccessorKind::ID: return #KEYWORD;
318+
#include "swift/AST/AccessorKinds.def"
319+
}
320+
321+
llvm_unreachable("Unhandled AccessorKind in switch.");
322+
}
313323
static StringRef
314324
getMagicIdentifierLiteralExprKindString(MagicIdentifierLiteralExpr::Kind value) {
315325
switch (value) {
@@ -3749,14 +3759,3 @@ void GenericEnvironment::dump(raw_ostream &os) const {
37493759
void GenericEnvironment::dump() const {
37503760
dump(llvm::errs());
37513761
}
3752-
3753-
StringRef swift::getAccessorKindString(AccessorKind value) {
3754-
switch (value) {
3755-
#define ACCESSOR(ID)
3756-
#define SINGLETON_ACCESSOR(ID, KEYWORD) \
3757-
case AccessorKind::ID: return #KEYWORD;
3758-
#include "swift/AST/AccessorKinds.def"
3759-
}
3760-
3761-
llvm_unreachable("Unhandled AccessorKind in switch.");
3762-
}

0 commit comments

Comments
 (0)