Skip to content

Commit 66aedab

Browse files
committed
---
yaml --- r: 340446 b: refs/heads/rxwei-patch-1 c: 8d1d863 h: refs/heads/master
1 parent 4807d99 commit 66aedab

Some content is hidden

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

52 files changed

+434
-632
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: fdb6e086adbeccfc96217e13b97b866367e129fb
1018+
refs/heads/rxwei-patch-1: 8d1d863f435c62b1f7a598b27f5880760504bf47
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/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Instructions for installing CMake and Ninja directly can be found [below](#build
9898

9999
For Ubuntu, you'll need the following development dependencies:
100100

101-
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
101+
sudo apt-get install git cmake ninja-build clang python uuid-dev libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config libblocksruntime-dev libcurl4-openssl-dev systemtap-sdt-dev tzdata rsync
102102

103103
**Note:** LLDB currently requires at least `swig-1.3.40` but will successfully build
104104
with version 2 shipped with Ubuntu.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ SIMPLE_DECL_ATTR(_implementationOnly, ImplementationOnly,
401401
DECL_ATTR(_custom, Custom,
402402
OnAnyDecl | UserInaccessible,
403403
85)
404-
SIMPLE_DECL_ATTR(propertyWrapper, PropertyWrapper,
404+
SIMPLE_DECL_ATTR(_propertyWrapper, PropertyWrapper,
405405
OnStruct | OnClass | OnEnum,
406406
86)
407407
SIMPLE_DECL_ATTR(_disfavoredOverload, DisfavoredOverload,

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5150,10 +5150,6 @@ class VarDecl : public AbstractStorageDecl {
51505150
/// \end
51515151
bool isPropertyWrapperInitializedWithInitialValue() const;
51525152

5153-
/// Whether the memberwise initializer parameter for a property with a property wrapper type
5154-
/// uses the wrapped type.
5155-
bool isPropertyMemberwiseInitializedWithWrappedType() const;
5156-
51575153
/// If this property is the backing storage for a property with an attached
51585154
/// property wrapper, return the original property.
51595155
///

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4462,9 +4462,6 @@ ERROR(property_wrapper_type_not_usable_from_inline,none,
44624462
"%select{%select{variable|constant}0|property}1 "
44634463
"must be '@usableFromInline' or public",
44644464
(bool, bool))
4465-
WARNING(property_wrapper_delegateValue,none,
4466-
"property wrapper's `delegateValue` property should be renamed to "
4467-
"'wrapperValue'; use of 'delegateValue' is deprecated", ())
44684465

44694466
//------------------------------------------------------------------------------
44704467
// MARK: function builder diagnostics

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

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5473,35 +5473,10 @@ VarDecl *VarDecl::getPropertyWrapperBackingProperty() const {
54735473
}
54745474

54755475
bool VarDecl::isPropertyWrapperInitializedWithInitialValue() const {
5476-
auto customAttr = getAttachedPropertyWrapper();
5477-
if (!customAttr)
5478-
return false;
5479-
5480-
auto *PBD = getParentPatternBinding();
5481-
if (!PBD)
5482-
return false;
5483-
5484-
// If there was an initializer on the original property, initialize
5485-
// via the initial value.
5486-
if (PBD->getPatternList()[0].getEqualLoc().isValid())
5487-
return true;
5488-
5489-
// If there was an initializer on the attribute itself, initialize
5490-
// via the full wrapper.
5491-
if (customAttr->getArg() != nullptr)
5492-
return false;
5493-
5494-
// Default initialization does not use a value.
5495-
auto wrapperTypeInfo = getAttachedPropertyWrapperTypeInfo();
5496-
if (wrapperTypeInfo.defaultInit)
5476+
auto &ctx = getASTContext();
5477+
if (!ctx.getLazyResolver())
54975478
return false;
54985479

5499-
// There is no initializer, so the initialization form depends on
5500-
// whether the property wrapper type has an init(initialValue:).
5501-
return wrapperTypeInfo.initialValueInit != nullptr;
5502-
}
5503-
5504-
bool VarDecl::isPropertyMemberwiseInitializedWithWrappedType() const {
55055480
auto customAttr = getAttachedPropertyWrapper();
55065481
if (!customAttr)
55075482
return false;
@@ -5520,6 +5495,11 @@ bool VarDecl::isPropertyMemberwiseInitializedWithWrappedType() const {
55205495
if (customAttr->getArg() != nullptr)
55215496
return false;
55225497

5498+
// If the property wrapper is default-initializable, it's the wrapper
5499+
// being initialized.
5500+
if (PBD->isDefaultInitializable(0))
5501+
return false;
5502+
55235503
// There is no initializer, so the initialization form depends on
55245504
// whether the property wrapper type has an init(initialValue:).
55255505
auto wrapperTypeInfo = getAttachedPropertyWrapperTypeInfo();

branches/rxwei-patch-1/lib/Parse/ParseDecl.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,12 +1800,6 @@ ParserStatus Parser::parseDeclAttribute(DeclAttributes &Attributes, SourceLoc At
18001800
checkInvalidAttrName("_inlineable", "inlinable", DAK_Inlinable);
18011801
}
18021802

1803-
// Other names of property wrappers...
1804-
checkInvalidAttrName("propertyDelegate", "propertyWrapper",
1805-
DAK_PropertyWrapper, diag::attr_renamed_warning);
1806-
checkInvalidAttrName("_propertyWrapper", "propertyWrapper",
1807-
DAK_PropertyWrapper, diag::attr_renamed_warning);
1808-
18091803
if (DK == DAK_Count && Tok.getText() == "warn_unused_result") {
18101804
// The behavior created by @warn_unused_result is now the default. Emit a
18111805
// Fix-It to remove.

branches/rxwei-patch-1/lib/SILGen/SILGen.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,13 +1137,10 @@ emitStoredPropertyInitialization(PatternBindingDecl *pbd, unsigned i) {
11371137
// If this is the backing storage for a property with an attached wrapper
11381138
// that was initialized with `=`, use that expression as the initializer.
11391139
if (auto originalProperty = var->getOriginalWrappedProperty()) {
1140-
if (originalProperty
1141-
->isPropertyMemberwiseInitializedWithWrappedType()) {
1142-
auto wrapperInfo =
1143-
originalProperty->getPropertyWrapperBackingPropertyInfo();
1144-
if (wrapperInfo.originalInitialValue)
1145-
init = wrapperInfo.originalInitialValue;
1146-
}
1140+
auto wrapperInfo =
1141+
originalProperty->getPropertyWrapperBackingPropertyInfo();
1142+
if (wrapperInfo.originalInitialValue)
1143+
init = wrapperInfo.originalInitialValue;
11471144
}
11481145

11491146
SILDeclRef constant(var, SILDeclRef::Kind::StoredPropertyInitializer);

branches/rxwei-patch-1/lib/SILGen/SILGenConstructor.cpp

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static bool maybeEmitPropertyWrapperInitFromValue(
112112
llvm::function_ref<void(Expr *)> body) {
113113
auto originalProperty = field->getOriginalWrappedProperty();
114114
if (!originalProperty ||
115-
!originalProperty->isPropertyMemberwiseInitializedWithWrappedType())
115+
!originalProperty->isPropertyWrapperInitializedWithInitialValue())
116116
return false;
117117

118118
auto wrapperInfo = originalProperty->getPropertyWrapperBackingPropertyInfo();
@@ -981,15 +981,11 @@ void SILGenFunction::emitMemberInitializers(DeclContext *dc,
981981
// property wrapper initialized with `=`, inject the value into an
982982
// instance of the wrapper.
983983
if (auto singleVar = pbd->getSingleVar()) {
984-
auto originalVar = singleVar->getOriginalWrappedProperty();
985-
if (originalVar &&
986-
originalVar->isPropertyWrapperInitializedWithInitialValue()) {
987-
(void)maybeEmitPropertyWrapperInitFromValue(
988-
*this, init, singleVar, std::move(result),
989-
[&](Expr *expr) {
990-
result = emitRValue(expr);
991-
});
992-
}
984+
(void)maybeEmitPropertyWrapperInitFromValue(
985+
*this, init, singleVar, std::move(result),
986+
[&](Expr *expr) {
987+
result = emitRValue(expr);
988+
});
993989
}
994990

995991
emitMemberInit(*this, selfDecl, entry.getPattern(), std::move(result));

branches/rxwei-patch-1/lib/SILOptimizer/Mandatory/DIMemoryUseCollector.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,11 +1568,15 @@ collectDelegatingInitUses(const DIMemoryObjectInfo &TheMemory,
15681568
// be an end_borrow use in addition to the value_metatype.
15691569
if (isa<LoadBorrowInst>(User)) {
15701570
auto UserVal = cast<SingleValueInstruction>(User);
1571-
bool onlyUseIsValueMetatype = true;
1571+
bool onlyUseIsValueMetatype = false;
15721572
for (auto use : UserVal->getUses()) {
1573-
if (isa<EndBorrowInst>(use->getUser())
1574-
|| isa<ValueMetatypeInst>(use->getUser()))
1573+
auto *user = use->getUser();
1574+
if (isa<EndBorrowInst>(user))
15751575
continue;
1576+
if (isa<ValueMetatypeInst>(user)) {
1577+
onlyUseIsValueMetatype = true;
1578+
continue;
1579+
}
15761580
onlyUseIsValueMetatype = false;
15771581
break;
15781582
}

branches/rxwei-patch-1/lib/SILOptimizer/Mandatory/MandatoryInlining.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ static void diagnose(ASTContext &Context, SourceLoc loc, Diag<T...> diag,
4646
Context.Diags.diagnose(loc, diag, std::forward<U>(args)...);
4747
}
4848

49-
static SILValue stripCopiesAndBorrows(SILValue v) {
50-
while (isa<CopyValueInst>(v) || isa<BeginBorrowInst>(v)) {
51-
v = cast<SingleValueInstruction>(v)->getOperand(0);
49+
static SILValue stripCopies(SILValue v) {
50+
while (auto *cvi = dyn_cast<CopyValueInst>(v)) {
51+
v = cvi->getOperand();
5252
}
5353
return v;
5454
}
@@ -329,7 +329,7 @@ static void cleanupCalleeValue(SILValue calleeValue) {
329329
}
330330
}
331331

332-
calleeValue = stripCopiesAndBorrows(calleeValue);
332+
calleeValue = stripCopies(calleeValue);
333333

334334
// Inline constructor
335335
auto calleeSource = ([&]() -> SILValue {
@@ -339,12 +339,12 @@ static void cleanupCalleeValue(SILValue calleeValue) {
339339
// will delete any uses of the closure, including a
340340
// convert_escape_to_noescape conversion.
341341
if (auto *cfi = dyn_cast<ConvertFunctionInst>(calleeValue))
342-
return stripCopiesAndBorrows(cfi->getOperand());
342+
return stripCopies(cfi->getOperand());
343343

344344
if (auto *cvt = dyn_cast<ConvertEscapeToNoEscapeInst>(calleeValue))
345-
return stripCopiesAndBorrows(cvt->getOperand());
345+
return stripCopies(cvt->getOperand());
346346

347-
return stripCopiesAndBorrows(calleeValue);
347+
return stripCopies(calleeValue);
348348
})();
349349

350350
if (auto *pai = dyn_cast<PartialApplyInst>(calleeSource)) {
@@ -359,7 +359,7 @@ static void cleanupCalleeValue(SILValue calleeValue) {
359359
calleeValue = callee;
360360
}
361361

362-
calleeValue = stripCopiesAndBorrows(calleeValue);
362+
calleeValue = stripCopies(calleeValue);
363363

364364
// Handle function_ref -> convert_function -> partial_apply/thin_to_thick.
365365
if (auto *cfi = dyn_cast<ConvertFunctionInst>(calleeValue)) {
@@ -579,7 +579,7 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
579579

580580
// Then grab a first approximation of our apply by stripping off all copy
581581
// operations.
582-
SILValue CalleeValue = stripCopiesAndBorrows(AI.getCallee());
582+
SILValue CalleeValue = stripCopies(AI.getCallee());
583583

584584
// If after stripping off copy_values, we have a load then see if we the
585585
// function we want to inline has a simple available value through a simple
@@ -588,7 +588,7 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
588588
CalleeValue = getLoadedCalleeValue(li);
589589
if (!CalleeValue)
590590
return nullptr;
591-
CalleeValue = stripCopiesAndBorrows(CalleeValue);
591+
CalleeValue = stripCopies(CalleeValue);
592592
}
593593

594594
// PartialApply/ThinToThick -> ConvertFunction patterns are generated
@@ -599,7 +599,7 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
599599
// a cast.
600600
auto skipFuncConvert = [](SILValue CalleeValue) {
601601
// Skip any copies that we see.
602-
CalleeValue = stripCopiesAndBorrows(CalleeValue);
602+
CalleeValue = stripCopies(CalleeValue);
603603

604604
// We can also allow a thin @escape to noescape conversion as such:
605605
// %1 = function_ref @thin_closure_impl : $@convention(thin) () -> ()
@@ -619,7 +619,7 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
619619
ToCalleeTy->getExtInfo().withNoEscape(false));
620620
if (FromCalleeTy != EscapingCalleeTy)
621621
return CalleeValue;
622-
return stripCopiesAndBorrows(ThinToNoescapeCast->getOperand());
622+
return stripCopies(ThinToNoescapeCast->getOperand());
623623
}
624624

625625
// Ignore mark_dependence users. A partial_apply [stack] uses them to mark
@@ -635,7 +635,7 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
635635

636636
auto *CFI = dyn_cast<ConvertEscapeToNoEscapeInst>(CalleeValue);
637637
if (!CFI)
638-
return stripCopiesAndBorrows(CalleeValue);
638+
return stripCopies(CalleeValue);
639639

640640
// TODO: Handle argument conversion. All the code in this file needs to be
641641
// cleaned up and generalized. The argument conversion handling in
@@ -651,9 +651,9 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
651651
auto EscapingCalleeTy =
652652
ToCalleeTy->getWithExtInfo(ToCalleeTy->getExtInfo().withNoEscape(false));
653653
if (FromCalleeTy != EscapingCalleeTy)
654-
return stripCopiesAndBorrows(CalleeValue);
654+
return stripCopies(CalleeValue);
655655

656-
return stripCopiesAndBorrows(CFI->getOperand());
656+
return stripCopies(CFI->getOperand());
657657
};
658658

659659
// Look through a escape to @noescape conversion.
@@ -666,11 +666,11 @@ getCalleeFunction(SILFunction *F, FullApplySite AI, bool &IsThick,
666666
// Collect the applied arguments and their convention.
667667
collectPartiallyAppliedArguments(PAI, CapturedArgConventions, FullArgs);
668668

669-
CalleeValue = stripCopiesAndBorrows(PAI->getCallee());
669+
CalleeValue = stripCopies(PAI->getCallee());
670670
IsThick = true;
671671
PartialApply = PAI;
672672
} else if (auto *TTTFI = dyn_cast<ThinToThickFunctionInst>(CalleeValue)) {
673-
CalleeValue = stripCopiesAndBorrows(TTTFI->getOperand());
673+
CalleeValue = stripCopies(TTTFI->getOperand());
674674
IsThick = true;
675675
}
676676

branches/rxwei-patch-1/lib/SILOptimizer/Utils/Local.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,6 @@ swift::tryToConcatenateStrings(ApplyInst *AI, SILBuilder &B) {
931931
// Closure Deletion
932932
//===----------------------------------------------------------------------===//
933933

934-
/// NOTE: Instructions with transitive ownership kind are assumed to not keep
935-
/// the underlying closure alive as well. This is meant for instructions only
936-
/// with non-transitive users.
937934
static bool useDoesNotKeepClosureAlive(const SILInstruction *I) {
938935
switch (I->getKind()) {
939936
case SILInstructionKind::StrongRetainInst:
@@ -942,7 +939,6 @@ static bool useDoesNotKeepClosureAlive(const SILInstruction *I) {
942939
case SILInstructionKind::RetainValueInst:
943940
case SILInstructionKind::ReleaseValueInst:
944941
case SILInstructionKind::DebugValueInst:
945-
case SILInstructionKind::EndBorrowInst:
946942
return true;
947943
default:
948944
return false;
@@ -955,9 +951,9 @@ static bool useHasTransitiveOwnership(const SILInstruction *I) {
955951
if (isa<ConvertEscapeToNoEscapeInst>(I))
956952
return true;
957953

958-
// Look through copy_value, begin_borrow. They are inert for our purposes, but
959-
// we need to look through it.
960-
return isa<CopyValueInst>(I) || isa<BeginBorrowInst>(I);
954+
// Look through copy_value. It is inert for our purposes, but we need to look
955+
// through it.
956+
return isa<CopyValueInst>(I);
961957
}
962958

963959
static SILValue createLifetimeExtendedAllocStack(

branches/rxwei-patch-1/lib/Sema/CSDiag.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,7 @@ bool FailureDiagnosis::diagnoseContextualConversionError(
22392239
CS.TC.isConvertibleTo(srcFT->getResult(), contextualType, CS.DC)) {
22402240

22412241
auto locator =
2242-
CS.getConstraintLocator(expr, LocatorPathElt::getContextualType());
2242+
CS.getConstraintLocator(expr, ConstraintLocator::ContextualType);
22432243
ContextualFailure failure =
22442244
ContextualFailure(nullptr, CS, srcFT, contextualType, locator);
22452245
auto diagnosed = failure.diagnoseAsError();
@@ -2320,7 +2320,7 @@ bool FailureDiagnosis::diagnoseContextualConversionError(
23202320
if (contextualType->isExistentialType()) {
23212321
MissingContextualConformanceFailure failure(
23222322
expr, CS, CTP, exprType, contextualType,
2323-
CS.getConstraintLocator(expr, LocatorPathElt::getContextualType()));
2323+
CS.getConstraintLocator(expr, ConstraintLocator::ContextualType));
23242324
return failure.diagnoseAsError();
23252325
}
23262326

@@ -5688,7 +5688,7 @@ bool FailureDiagnosis::diagnoseClosureExpr(
56885688

56895689
MissingArgumentsFailure failure(
56905690
expr, CS, fnType, inferredArgCount - actualArgCount,
5691-
CS.getConstraintLocator(CE, LocatorPathElt::getContextualType()));
5691+
CS.getConstraintLocator(CE, ConstraintLocator::ContextualType));
56925692
return failure.diagnoseAsError();
56935693
}
56945694

branches/rxwei-patch-1/lib/Sema/CSSimplify.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
29502950
// literals and expressions representing an implicit return type of the single
29512951
// expression functions.
29522952
if (auto elt = locator.last()) {
2953-
if (elt->isClosureResult() || elt->isResultOfSingleExprFunction()) {
2953+
if (elt->getKind() == ConstraintLocator::ClosureResult ||
2954+
elt->getKind() == ConstraintLocator::SingleExprFuncResultType) {
29542955
if (kind >= ConstraintKind::Subtype &&
29552956
(type1->isUninhabited() || type2->isVoid())) {
29562957
increaseScore(SK_FunctionConversion);
@@ -5419,9 +5420,8 @@ ConstraintSystem::simplifyKeyPathConstraint(Type keyPathTy,
54195420
{rootTy, valueTy});
54205421
// Let's check whether deduced key path type would match
54215422
// expected contextual one.
5422-
return matchTypes(
5423-
resolvedKPTy, keyPathTy, ConstraintKind::Bind, subflags,
5424-
locator.withPathElement(LocatorPathElt::getContextualType()));
5423+
return matchTypes(resolvedKPTy, keyPathTy, ConstraintKind::Bind, subflags,
5424+
locator.withPathElement(ConstraintLocator::ContextualType));
54255425
}
54265426

54275427
ConstraintSystem::SolutionKind

branches/rxwei-patch-1/lib/Sema/CSSolver.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,10 +1216,10 @@ ConstraintSystem::solveImpl(Expr *&expr,
12161216
if (getContextualTypePurpose() == CTP_YieldByReference)
12171217
constraintKind = ConstraintKind::Bind;
12181218

1219-
bool isForSingleExprFunction =
1220-
getContextualTypePurpose() == CTP_ReturnSingleExpr;
12211219
auto *convertTypeLocator = getConstraintLocator(
1222-
expr, LocatorPathElt::getContextualType(isForSingleExprFunction));
1220+
expr, getContextualTypePurpose() == CTP_ReturnSingleExpr
1221+
? ConstraintLocator::SingleExprFuncResultType
1222+
: ConstraintLocator::ContextualType);
12231223

12241224
if (allowFreeTypeVariables == FreeTypeVariableBinding::UnresolvedType) {
12251225
convertType = convertType.transform([&](Type type) -> Type {

0 commit comments

Comments
 (0)