Skip to content

Fix CI issues in the 5.3 branch #1560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 88 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
cf4cd6a
Fix typo in 'KeyedEncodingContainer.superEncoder' documentation. (#32…
rxwei Jun 9, 2020
3aa05d7
[stdlib] Add _forEachField(of:options:body:) function (#32873)
natecook1000 Jul 14, 2020
fbf9dda
runtime: correct the `asprintf` shim for Windows
compnerd Jul 15, 2020
be26b83
Make the argument-label diagnostics slightly more robust.
DougGregor Jul 2, 2020
f7f8096
Forward matching of trailing closure arguments.
DougGregor Jul 1, 2020
e746017
Extend the "fuzzy" forward scan matching to support multiple trailing…
DougGregor Jul 16, 2020
676e9df
[Trailing closures] Allow the unlabeled closure for variadic closure …
DougGregor Jul 16, 2020
3243c52
Lacking parameter declarations, and parameter accepts trailing closures
DougGregor Jul 17, 2020
f39a889
[Type checker] Improve diagnostics for trailing closures.
DougGregor Jul 17, 2020
8fafa52
[Diagnostics] Remove the now-unused AllowInvalidUseOfTrailingClosure
DougGregor Jul 17, 2020
f774fbd
[Trailing closures] Enable "fuzzy" heuristic by default everywhere.
DougGregor Jul 18, 2020
9f2546b
[Trailing closures] Diagnose the change in behavior with SE-0268.
DougGregor Jul 18, 2020
82e4c50
Fix a NULL pointer dereference and update test cases.
DougGregor Jul 18, 2020
9d19ef2
[Cleanup] Use swift::getParameterList() rather than hard-coding it.
DougGregor Jul 18, 2020
79263cb
[Trailing closures] Attempt both forward and backward scans.
DougGregor Jul 23, 2020
bb66d45
[Trailing closures] Warn about use of deprecated "backward" scan.
DougGregor Jul 23, 2020
8b8aacd
[Trailing closures] Reinstate the "skip defaulted argument" heuristic.
DougGregor Jul 23, 2020
543eb68
[Trailing closures] Bias toward the backward scan for ambiguities.
DougGregor Jul 24, 2020
d3ab488
[Trailing closures] Remove dynamically-dead warning about behavior ch…
DougGregor Jul 24, 2020
1af4c6d
Adjust for 5.3 branch
DougGregor Jul 24, 2020
ed1c76d
Only execute test for supported simulator plaforms
shahmishal Jul 23, 2020
40ee9e5
[XFAIL] Sema/SwiftUI/rdar57201781.swift and Constraints/trailing_clos…
shahmishal Jul 25, 2020
62e6834
Merge pull request #32965 from lorentey/the-fields-are-alive-with-the…
lorentey Jul 27, 2020
b982f61
Adjust to simulator compiler_rt change
beccadax Jul 27, 2020
377c17c
[NFC] Clean up unused simulator special cases
beccadax Jul 27, 2020
2e85f09
[build-script] copy over the simulator libclang_rt.*.a libraries to a…
hyp Jul 27, 2020
f3ec9d5
[AST] Mark repr invalid only if `@autoclosure` parameter doesn't poin…
xedin Jul 27, 2020
ab06af8
Merge pull request #33155 from hyp/fix-compiler-rt-sim-libs-5.3
fredriss Jul 28, 2020
1733014
[Serialization] Load swiftmodule files as volatile to avoid mmap
xymus Jul 18, 2020
8b9dd95
[Serialization] Add more context to why we load swiftmodule files as …
xymus Jul 21, 2020
b3c6c5e
Merge pull request #33094 from DougGregor/se-0286-trailing-closure-so…
DougGregor Jul 28, 2020
c7053b8
[Serialization] Move loading swiftmodule files as volatile behind a flag
xymus Jul 22, 2020
0a6f99a
Merge pull request #32661 from amartini51/release/5.3
swift-ci Jul 29, 2020
50db6e4
Merge pull request #33162 from xedin/rdar-65704049-5.3
xedin Jul 29, 2020
7faf378
[Function Builders] Teach diagnostics about function builder body
hborla Jul 28, 2020
026b51b
[ConstraintLocator] Add a `isFirstElement` helper function
hborla Jul 28, 2020
a30cf9c
Merge pull request #33174 from hborla/5.3-function-builder-body-resul…
hborla Jul 29, 2020
0499501
[build] SourceKit no longer cross-compiles with the Swift 5.3 snapshots
finagolfin Jul 29, 2020
20b155a
Merge pull request #33104 from apple/shahmishal/execute-tests-on-supp…
shahmishal Jul 29, 2020
0f5352f
[5.3] Add missing `-f` to check which checks if a compiler-rt archive…
hyp Jul 29, 2020
ffef4da
Merge pull request #33172 from xymus/volatile-swiftmodules-5.3
xymus Jul 29, 2020
f651666
Merge pull request #33173 from brentdax/runtime-revolution-5.3
beccadax Jul 29, 2020
df260af
Mark main() as used
beccadax Jul 29, 2020
74f6199
Merge pull request #33184 from apple/eng/hyp-5.3-add-missing-f
hyp Jul 30, 2020
3700edb
[SourceKit] Fix issue where `CompletionCheckDependencyInterval` is se…
akyrtzi Jul 30, 2020
6ab40f2
[CodeCompletion] Fix issue in dependency checking for the editing file
rintaro Jul 30, 2020
d8b7742
[Sema] Warn when exporting implementation-only types in SPI
xymus Jul 30, 2020
9b9f6dc
Merge pull request #33209 from akyrtzi/5.3-fast-completion-depend-che…
akyrtzi Jul 30, 2020
9a3a92b
IRGen: Give ObjC metadata symbols internal linkage. (#33193)
jckarter Jul 30, 2020
5ad3d0e
Merge pull request #33210 from rintaro/5.3-ide-completion-rdar66301353
akyrtzi Jul 30, 2020
1167701
[CodeCompletion] Handle @autoclosure in context type analysis
rintaro Jul 30, 2020
a8dcb57
Merge pull request #33177 from brentdax/they-buffed-my-main-5.3
tkremenek Jul 31, 2020
15074dc
Revert "[Apple Silicon] Adjust linking deployment target from 11.0 do…
beccadax Jul 31, 2020
ed7bb01
[5.3] Type substitution: When substituting SILFunctionTypes we substi…
aschwaighofer May 26, 2020
da8aff0
Merge pull request #33213 from xymus/spi-ioi-check-workaround-5.3
tkremenek Jul 31, 2020
91d3180
Merge pull request #33219 from rintaro/5.3-ide-completion-rdar65802490
rintaro Jul 31, 2020
c80e78c
IRGen: Update some straggling tests for #33192
jckarter Jul 31, 2020
a938afc
[Property Wrappers] Don't inject the wrapped value placeholder
hborla Jul 31, 2020
c49f0c4
[TypeChecker] NFC: Clarify flaky diagnostic XFAIL
xedin Jun 27, 2020
9cdd622
Merge pull request #33242 from xedin/xfail-flaky-diagnostic-5.3
rintaro Aug 1, 2020
9a10c0b
Merge pull request #33237 from rintaro/5.3-rdar66384432
rintaro Aug 1, 2020
ff06d84
Merge pull request #33240 from hborla/5.3-invalid-wrapped-value-place…
hborla Aug 1, 2020
7f87104
[TypeChecker] Diagnose empty `switch` statements in function builder …
xedin Jul 31, 2020
65fffb1
Merge pull request #33247 from xedin/rdar-65983237-5.3
xedin Aug 3, 2020
5d3b598
Merge pull request #33228 from aschwaighofer/type_substitute_objc_gen…
aschwaighofer Aug 3, 2020
e7360e0
[CodeCompletion] Disable multi trailing closure completion at newline
rintaro Aug 3, 2020
43a2929
[IRGen] Add main() to __swift5_entry.
nate-chandler Aug 1, 2020
09968d2
[Diagnostics] Do more checking before recording `force downcast` fix
xedin Aug 3, 2020
3e5ecba
SILGen: Lower formal callee type pre-opaque-type-substitution.
jckarter Aug 4, 2020
15665a1
Merge pull request #33225 from brentdax/stop-pretending-5.3
beccadax Aug 4, 2020
17098b1
Merge pull request #33266 from rintaro/5.3-ide-completion-rdar66456159
rintaro Aug 4, 2020
a277175
Merge pull request #33273 from xedin/rdar-65254452-5.3
tkremenek Aug 4, 2020
7cced30
Merge pull request #33182 from buttaface/kit
akyrtzi Aug 4, 2020
ec8873e
[__swift5_entry] Do not emit segment for repl.
nate-chandler Aug 4, 2020
8565544
Merge pull request #33276 from jckarter/opaque-substitution-substitut…
jckarter Aug 4, 2020
94929b6
Merge pull request #33269 from nate-chandler/emit-main-into-entry-seg…
tkremenek Aug 4, 2020
6ccd013
[Diagnostics] Detect and diagnose type mismatches related to function…
xedin Aug 4, 2020
80f8731
Merge pull request #33299 from xedin/rdar-65413640-5.3
xedin Aug 5, 2020
65b475b
[NFC] Rid ourselves of a troublesome test
beccadax Aug 5, 2020
2556f22
Merge pull request #33312 from brentdax/depose-the-pretender-5.3
rintaro Aug 5, 2020
08af507
Revert "Refactor Mirror to reduce metadata allocation (#32041) (#3295…
airspeedswift Aug 6, 2020
d5a7cc4
Sema: Fix crash on circular reference in checkContextualRequirements()
slavapestov Jul 9, 2020
19ad53e
Temporarily disable failing test
slavapestov Aug 7, 2020
8d99f24
Merge pull request #33369 from slavapestov/disable-test-rdar66693249-5.3
slavapestov Aug 7, 2020
fc45397
Merge pull request #33350 from CodaFi/a-circle-most-vicious
tkremenek Aug 7, 2020
f6f05dc
Merge branch 'release/5.3' of github.com:swiftwasm/swift into maxd/fi…
MaxDesiatov Aug 10, 2020
903fc2b
[WASM] Add AAarch64 target to cross-compile for arm64
kateinoigakukun Aug 7, 2020
63d94c8
[WASM] Define and declare swift_isClassType as swiftcc because it got…
kateinoigakukun Aug 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3594,6 +3594,8 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
/// initializer.
bool hasDefaultInitializer() const;

bool isTypeErasedGenericClass() const;

/// Retrieves the synthesized zero parameter default initializer for this
/// declaration, or \c nullptr if it doesn't have one.
ConstructorDecl *getDefaultInitializer() const;
Expand Down
12 changes: 12 additions & 0 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,12 @@ ERROR(extra_trailing_closure_in_call,none,
ERROR(trailing_closure_bad_param,none,
"trailing closure passed to parameter of type %0 that does not "
"accept a closure", (Type))
WARNING(unlabeled_trailing_closure_deprecated,none,
"backward matching of the unlabeled trailing closure is deprecated; label the argument with %0 to suppress this warning",
(Identifier))
NOTE(decl_multiple_defaulted_closure_parameters,none,
"%0 contains defaulted closure parameters %1 and %2",
(DeclName, Identifier, Identifier))
NOTE(candidate_with_extraneous_args,none,
"candidate %0 requires %1 argument%s1, "
"but %2 %select{were|was}3 %select{provided|used in closure body}4",
Expand Down Expand Up @@ -2678,6 +2684,12 @@ ERROR(decl_from_hidden_module,none,
"%select{%3 has been imported as implementation-only|"
"it is an SPI imported from %3}4",
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
WARNING(decl_from_hidden_module_warn,none,
"cannot use %0 %1 %select{in SPI|as property wrapper in SPI|"
"in an extension with public or '@usableFromInline' members|"
"in an extension with conditional conformances}2; "
"%select{%3 has been imported as implementation-only}4",
(DescriptiveDeclKind, DeclName, unsigned, Identifier, unsigned))
ERROR(conformance_from_implementation_only_module,none,
"cannot use conformance of %0 to %1 %select{here|as property wrapper here|"
"in an extension with public or '@usableFromInline' members|"
Expand Down
6 changes: 6 additions & 0 deletions include/swift/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ class CanType : public Type {
static bool isExistentialTypeImpl(CanType type);
static bool isAnyExistentialTypeImpl(CanType type);
static bool isObjCExistentialTypeImpl(CanType type);
static bool isTypeErasedGenericClassTypeImpl(CanType type);
static CanType getOptionalObjectTypeImpl(CanType type);
static CanType getReferenceStorageReferentImpl(CanType type);
static CanType getWithoutSpecifierTypeImpl(CanType type);
Expand Down Expand Up @@ -475,6 +476,11 @@ class CanType : public Type {
return isObjCExistentialTypeImpl(*this);
}

// Is this an ObjC generic class.
bool isTypeErasedGenericClassType() const {
return isTypeErasedGenericClassTypeImpl(*this);
}

ClassDecl *getClassOrBoundGenericClass() const; // in Types.h
StructDecl *getStructOrBoundGenericStruct() const; // in Types.h
EnumDecl *getEnumOrBoundGenericEnum() const; // in Types.h
Expand Down
5 changes: 5 additions & 0 deletions include/swift/AST/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -3484,6 +3484,7 @@ END_CAN_TYPE_WRAPPER(FunctionType, AnyFunctionType)
/// has a default argument.
struct ParameterListInfo {
SmallBitVector defaultArguments;
SmallBitVector acceptsUnlabeledTrailingClosures;

public:
ParameterListInfo() { }
Expand All @@ -3494,6 +3495,10 @@ struct ParameterListInfo {
/// Whether the parameter at the given index has a default argument.
bool hasDefaultArgument(unsigned paramIdx) const;

/// Whether the parameter accepts an unlabeled trailing closure argument
/// according to the "forward-scan" rule.
bool acceptsUnlabeledTrailingClosureArgument(unsigned paramIdx) const;

/// Retrieve the number of non-defaulted parameters.
unsigned numNonDefaultedParameters() const {
return defaultArguments.count();
Expand Down
11 changes: 11 additions & 0 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,14 @@ namespace swift {
/// Build the ASTScope tree lazily
bool LazyASTScopes = true;

/// Whether to enable the "fuzzy" forward-scanning behavior for trailing
/// closure matching, which skips over defaulted closure parameters
/// to match later (non-defaulted) closure parameters
///
/// This is a backward-compatibility hack for unlabeled trailing closures,
/// to be disabled in Swift 6+.
bool EnableFuzzyForwardScanTrailingClosureMatching = true;

/// Use Clang function types for computing canonical types.
/// If this option is false, the clang function types will still be computed
/// but will not be used for checking type equality.
Expand Down Expand Up @@ -350,6 +358,9 @@ namespace swift {
/// If set to \c false, fall back to the legacy manual reference name tracking code.
bool EnableRequestBasedIncrementalDependencies = true;

/// Load swiftmodule files in memory as volatile and avoid mmap.
bool EnableVolatileModules = false;

/// Sets the target we are building for and updates platform conditions
/// to match.
///
Expand Down
5 changes: 0 additions & 5 deletions include/swift/Basic/Platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@ namespace swift {
/// Returns the platform Kind for Darwin triples.
DarwinPlatformKind getDarwinPlatformKind(const llvm::Triple &triple);

/// Maps an arbitrary platform to its non-simulator equivalent.
///
/// If \p platform is not a simulator platform, it will be returned as is.
DarwinPlatformKind getNonSimulatorPlatform(DarwinPlatformKind platform);

/// Returns the architecture component of the path for a given target triple.
///
/// Typically this is used for mapping the architecture component of the
Expand Down
3 changes: 3 additions & 0 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ def warn_long_expression_type_checking_EQ : Joined<["-"], "warn-long-expression-
def Rmodule_interface_rebuild : Flag<["-"], "Rmodule-interface-rebuild">,
HelpText<"Emits a remark if an imported module needs to be re-compiled from its module interface">;

def enable_volatile_modules : Flag<["-"], "enable-volatile-modules">,
HelpText<"Load Swift modules in memory">;

def solver_expression_time_threshold_EQ : Joined<["-"], "solver-expression-time-threshold=">;

def solver_disable_shrink :
Expand Down
10 changes: 10 additions & 0 deletions include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,16 @@ def enable_experimental_concise_pound_file : Flag<["-"],
Flags<[FrontendOption, ModuleInterfaceOption]>,
HelpText<"Enable experimental concise '#file' identifier">;

def disable_fuzzy_forward_scan_trailing_closure_matching : Flag<["-"],
"disable-fuzzy-forward-scan-trailing-closure-matching">,
Flags<[FrontendOption]>,
HelpText<"Disable fuzzy forward-scan trailing closure matching">;

def enable_fuzzy_forward_scan_trailing_closure_matching : Flag<["-"],
"enable-fuzzy-forward-scan-trailing-closure-matching">,
Flags<[FrontendOption]>,
HelpText<"Enable fuzzy forward-scan trailing closure matching">;

// Diagnostic control options
def suppress_warnings : Flag<["-"], "suppress-warnings">,
Flags<[FrontendOption]>,
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Runtime/RuntimeFunctions.def
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ FUNCTION(ConformsToProtocol,

// bool swift_isClassType(type*);
FUNCTION(IsClassType,
swift_isClassType, C_CC, AlwaysAvailable,
swift_isClassType, SwiftCC, AlwaysAvailable,
RETURNS(Int1Ty),
ARGS(TypeMetadataPtrTy),
ATTRS(ZExt, NoUnwind, ReadNone))
Expand Down
8 changes: 8 additions & 0 deletions lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4190,6 +4190,14 @@ bool NominalTypeDecl::hasDefaultInitializer() const {
false);
}

bool NominalTypeDecl::isTypeErasedGenericClass() const {
// ObjC classes are type erased.
// TODO: Unless they have magic methods...
if (auto clas = dyn_cast<ClassDecl>(this))
return clas->hasClangNode() && clas->isGenericContext();
return false;
}

ConstructorDecl *NominalTypeDecl::getDefaultInitializer() const {
if (!hasDefaultInitializer())
return nullptr;
Expand Down
20 changes: 17 additions & 3 deletions lib/AST/Expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,15 +1271,29 @@ SourceRange TupleExpr::getSourceRange() const {
return { SourceLoc(), SourceLoc() };
} else {
// Scan backwards for a valid source loc.
bool hasSingleTrailingClosure = hasTrailingClosure();
for (Expr *expr : llvm::reverse(getElements())) {
// Default arguments are located at the start of their parent tuple, so
// skip over them.
if (isa<DefaultArgumentExpr>(expr))
continue;
end = expr->getEndLoc();
if (end.isValid()) {
break;

SourceLoc newEnd = expr->getEndLoc();
if (newEnd.isInvalid())
continue;

// There is a quirk with the backward scan logic for trailing
// closures that can cause arguments to be flipped. If there is a
// single trailing closure, only stop when the "end" point we hit comes
// after the close parenthesis (if there is one).
if (end.isInvalid() ||
end.getOpaquePointerValue() < newEnd.getOpaquePointerValue()) {
end = newEnd;
}

if (!hasSingleTrailingClosure || RParenLoc.isInvalid() ||
RParenLoc.getOpaquePointerValue() < end.getOpaquePointerValue())
break;
}
}
} else {
Expand Down
69 changes: 63 additions & 6 deletions lib/AST/Type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ bool CanType::isObjCExistentialTypeImpl(CanType type) {
return type.getExistentialLayout().isObjC();
}

bool CanType::isTypeErasedGenericClassTypeImpl(CanType type) {
if (auto nom = type->getAnyNominal())
return nom->isTypeErasedGenericClass();
return false;
}

bool TypeBase::isSpecialized() {
Type t = getCanonicalType();

Expand Down Expand Up @@ -822,6 +828,32 @@ Type TypeBase::replaceCovariantResultType(Type newResultType,
return FunctionType::get(inputType, resultType, fnType->getExtInfo());
}

/// Whether this parameter accepts an unlabeled trailing closure argument
/// using the more-restrictive forward-scan rule.
static bool allowsUnlabeledTrailingClosureParameter(const ParamDecl *param) {
// inout parameters never allow an unlabeled trailing closure.
if (param->isInOut())
return false;

Type paramType = param->isVariadic() ? param->getVarargBaseTy()
: param->getInterfaceType();
paramType = paramType->getRValueType()->lookThroughAllOptionalTypes();

// For autoclosure parameters, look through the autoclosure result type
// to get the actual argument type.
if (param->isAutoClosure()) {
auto fnType = paramType->getAs<AnyFunctionType>();
if (!fnType)
return false;

paramType = fnType->getResult()->lookThroughAllOptionalTypes();
}

// After lookup through all optional types, this parameter allows an
// unlabeled trailing closure if it is (structurally) a function type.
return paramType->is<AnyFunctionType>();
}

ParameterListInfo::ParameterListInfo(
ArrayRef<AnyFunctionType::Param> params,
const ValueDecl *paramOwner,
Expand All @@ -831,7 +863,7 @@ ParameterListInfo::ParameterListInfo(
// No parameter owner means no parameter list means no default arguments
// - hand back the zeroed bitvector.
//
// FIXME: We ought to not request default argument info in this case.
// FIXME: We ought to not request paramer list info in this case.
if (!paramOwner)
return;

Expand Down Expand Up @@ -865,12 +897,21 @@ ParameterListInfo::ParameterListInfo(
if (params.size() != paramList->size())
return;

// Note which parameters have default arguments and/or function builders.
// Now we have enough information to determine which parameters accept
// unlabled trailing closures.
acceptsUnlabeledTrailingClosures.resize(params.size());

// Note which parameters have default arguments and/or accept unlabeled
// trailing closure arguments with the forward-scan rule.
for (auto i : range(0, params.size())) {
auto param = paramList->get(i);
if (param->isDefaultArgument()) {
defaultArguments.set(i);
}

if (allowsUnlabeledTrailingClosureParameter(param)) {
acceptsUnlabeledTrailingClosures.set(i);
}
}
}

Expand All @@ -879,6 +920,12 @@ bool ParameterListInfo::hasDefaultArgument(unsigned paramIdx) const {
: false;
}

bool ParameterListInfo::acceptsUnlabeledTrailingClosureArgument(
unsigned paramIdx) const {
return paramIdx >= acceptsUnlabeledTrailingClosures.size() ||
acceptsUnlabeledTrailingClosures[paramIdx];
}

/// Turn a param list into a symbolic and printable representation that does not
/// include the types, something like (_:, b:, c:)
std::string swift::getParamListAsString(ArrayRef<AnyFunctionType::Param> params) {
Expand Down Expand Up @@ -4261,17 +4308,27 @@ case TypeKind::Id:
case TypeKind::SILFunction: {
auto fnTy = cast<SILFunctionType>(base);
bool changed = false;

auto hasTypeErasedGenericClassType = [](Type ty) -> bool {
return ty.findIf([](Type subType) -> bool {
if (subType->getCanonicalType().isTypeErasedGenericClassType())
return true;
else
return false;
});
};
auto updateSubs = [&](SubstitutionMap &subs) -> bool {
// This interface isn't suitable for updating the substitution map in a
// substituted SILFunctionType.
// TODO(SILFunctionType): Is it suitable for any SILFunctionType??
SmallVector<Type, 4> newReplacements;
for (Type type : subs.getReplacementTypes()) {
auto transformed = type.transformRec(fn);
assert((type->isEqual(transformed)
|| (type->hasTypeParameter() && transformed->hasTypeParameter()))
&& "Substituted SILFunctionType can't be transformed into a concrete type");
assert((type->isEqual(transformed) ||
(type->hasTypeParameter() && transformed->hasTypeParameter()) ||
(hasTypeErasedGenericClassType(type) &&
hasTypeErasedGenericClassType(transformed))) &&
"Substituted SILFunctionType can't be transformed into a "
"concrete type");
newReplacements.push_back(transformed->getCanonicalType());
if (!type->isEqual(transformed))
changed = true;
Expand Down
17 changes: 0 additions & 17 deletions lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,6 @@ DarwinPlatformKind swift::getDarwinPlatformKind(const llvm::Triple &triple) {
llvm_unreachable("Unsupported Darwin platform");
}

DarwinPlatformKind swift::getNonSimulatorPlatform(DarwinPlatformKind platform) {
switch (platform) {
case DarwinPlatformKind::MacOS:
return DarwinPlatformKind::MacOS;
case DarwinPlatformKind::IPhoneOS:
case DarwinPlatformKind::IPhoneOSSimulator:
return DarwinPlatformKind::IPhoneOS;
case DarwinPlatformKind::TvOS:
case DarwinPlatformKind::TvOSSimulator:
return DarwinPlatformKind::TvOS;
case DarwinPlatformKind::WatchOS:
case DarwinPlatformKind::WatchOSSimulator:
return DarwinPlatformKind::WatchOS;
}
llvm_unreachable("Unsupported Darwin platform");
}

static StringRef getPlatformNameForDarwin(const DarwinPlatformKind platform) {
switch (platform) {
case DarwinPlatformKind::MacOS:
Expand Down
17 changes: 3 additions & 14 deletions lib/Driver/DarwinToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,9 @@ toolchains::Darwin::constructInvocation(const InterpretJobAction &job,
}

static StringRef
getDarwinLibraryNameSuffixForTriple(const llvm::Triple &triple,
bool distinguishSimulator = true) {
getDarwinLibraryNameSuffixForTriple(const llvm::Triple &triple) {
const DarwinPlatformKind kind = getDarwinPlatformKind(triple);
const DarwinPlatformKind effectiveKind =
distinguishSimulator ? kind : getNonSimulatorPlatform(kind);
switch (effectiveKind) {
switch (kind) {
case DarwinPlatformKind::MacOS:
return "osx";
case DarwinPlatformKind::IPhoneOS:
Expand Down Expand Up @@ -622,14 +619,6 @@ toolchains::Darwin::addDeploymentTargetArgs(ArgStringList &Arguments,
micro = firstMacARM64e.getSubminor().getValueOr(0);
}

// Temporary hack: adjust macOS version passed to the linker from
// 11 down to 10.16, but only for x86.
if (triple.isX86() && major == 11) {
major = 10;
minor = 16;
micro = 0;
}

break;
case DarwinPlatformKind::IPhoneOS:
case DarwinPlatformKind::IPhoneOSSimulator:
Expand Down Expand Up @@ -754,7 +743,7 @@ toolchains::Darwin::constructInvocation(const DynamicLinkJobAction &job,
llvm::sys::path::append(
CompilerRTPath,
Twine("libclang_rt.") +
getDarwinLibraryNameSuffixForTriple(Triple, /*simulator*/false) +
getDarwinLibraryNameSuffixForTriple(Triple) +
".a");
if (llvm::sys::fs::exists(CompilerRTPath))
Arguments.push_back(context.Args.MakeArgString(CompilerRTPath));
Expand Down
4 changes: 4 additions & 0 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
inputArgs.AddLastArg(arguments, options::OPT_disable_parser_lookup);
inputArgs.AddLastArg(arguments,
options::OPT_enable_experimental_concise_pound_file);
inputArgs.AddLastArg(
arguments,
options::OPT_enable_fuzzy_forward_scan_trailing_closure_matching,
options::OPT_disable_fuzzy_forward_scan_trailing_closure_matching);
inputArgs.AddLastArg(arguments,
options::OPT_verify_incremental_dependencies);

Expand Down
Loading