Skip to content

Commit b981cc4

Browse files
committed
Merge branch 'master' of github.com:swiftwasm/swift into maxd/master-merge
# Conflicts: # test/stdlib/POSIX.swift
2 parents ed26036 + 0968d16 commit b981cc4

Some content is hidden

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

55 files changed

+799
-743
lines changed

cmake/modules/AddSwift.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,15 @@ function(add_swift_host_library name)
557557
target_link_options(${name} PRIVATE
558558
"LINKER:-current_version,${SWIFT_COMPILER_VERSION}")
559559
endif()
560+
561+
set(DEPLOYMENT_VERSION "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_DEPLOYMENT_VERSION}")
562+
# MSVC, clang-cl, gcc don't understand -target.
563+
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT SWIFT_COMPILER_IS_MSVC_LIKE)
564+
get_target_triple(target target_variant "${SWIFT_HOST_VARIANT_SDK}" "${SWIFT_HOST_VARIANT_ARCH}"
565+
MACCATALYST_BUILD_FLAVOR ""
566+
DEPLOYMENT_VERSION "${DEPLOYMENT_VERSION}")
567+
target_link_options(${name} PRIVATE -target;${target})
568+
endif()
560569
endif()
561570

562571
add_dependencies(dev ${name})

docs/Testing.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ We use multiple approaches to test the Swift toolchain.
2424
locally before committing. (Usually on a single platform, and not necessarily
2525
all tests.)
2626
* Buildbots run all tests, on all supported platforms.
27+
[Smoke testing](ContinuousIntegration.md#smoke-testing)
28+
skips the iOS, tvOS, and watchOS platforms.
29+
30+
The [test/lit.cfg](https://github.com/apple/swift/blob/master/test/lit.cfg)
31+
uses an iOS 10.3 simulator configuration named "iPhone 5" for 32-bit testing.
32+
33+
1. Download and install the iOS 10.3 simulator runtime, in Xcode's
34+
[Components](https://help.apple.com/xcode/#/deva7379ae35) preferences.
35+
36+
2. Create an "iPhone 5" simulator configuration, either in Xcode's
37+
[Devices and Simulators](https://help.apple.com/xcode/#/devf225e58da)
38+
window, or with the command line:
39+
40+
```sh
41+
xcrun simctl create 'iPhone 5' 'com.apple.CoreSimulator.SimDeviceType.iPhone-5'
42+
```
43+
44+
3. Append `--ios` to the `utils/build-script` command line (see below).
2745

2846
### Testsuite subsets
2947

include/swift/ABI/TypeIdentity.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ class ParsedTypeIdentity {
184184
StringRef FullIdentity;
185185

186186
/// Any extended information that type might have.
187-
Optional<TypeImportInfo<StringRef>> ImportInfo;
187+
llvm::Optional<TypeImportInfo<StringRef>> ImportInfo;
188188

189189
/// The ABI name of the type.
190190
StringRef getABIName() const {

include/swift/AST/DeclContext.h

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ namespace swift {
5151
class Expr;
5252
class GenericParamList;
5353
class LazyMemberLoader;
54+
class GenericContext;
5455
class GenericSignature;
5556
class GenericTypeParamDecl;
5657
class GenericTypeParamType;
@@ -566,41 +567,6 @@ class alignas(1 << DeclContextAlignInBits) DeclContext {
566567
LLVM_READONLY
567568
ASTContext &getASTContext() const;
568569

569-
/// Retrieve the set of protocols whose conformances will be
570-
/// associated with this declaration context.
571-
///
572-
/// This function differs from \c getLocalConformances() in that it
573-
/// returns protocol declarations, not protocol conformances, and
574-
/// therefore does not require the protocol conformances to be
575-
/// formed.
576-
///
577-
/// \param lookupKind The kind of lookup to perform.
578-
///
579-
/// FIXME: This likely makes more sense on IterableDeclContext or
580-
/// something similar.
581-
SmallVector<ProtocolDecl *, 2>
582-
getLocalProtocols(ConformanceLookupKind lookupKind
583-
= ConformanceLookupKind::All) const;
584-
585-
/// Retrieve the set of protocol conformances associated with this
586-
/// declaration context.
587-
///
588-
/// \param lookupKind The kind of lookup to perform.
589-
///
590-
/// FIXME: This likely makes more sense on IterableDeclContext or
591-
/// something similar.
592-
SmallVector<ProtocolConformance *, 2>
593-
getLocalConformances(ConformanceLookupKind lookupKind
594-
= ConformanceLookupKind::All) const;
595-
596-
/// Retrieve diagnostics discovered while expanding conformances for this
597-
/// declaration context. This operation then removes those diagnostics from
598-
/// consideration, so subsequent calls to this function with the same
599-
/// declaration context that have not had any new extensions bound
600-
/// will see an empty array.
601-
SmallVector<ConformanceDiagnostic, 4>
602-
takeConformanceDiagnostics() const;
603-
604570
/// Retrieves a list of separately imported overlays which are shadowing
605571
/// \p declaring. If any \p overlays are returned, qualified lookups into
606572
/// \p declaring should be performed into \p overlays instead; since they
@@ -815,9 +781,40 @@ class IterableDeclContext {
815781
/// valid).
816782
bool wasDeserialized() const;
817783

784+
/// Retrieve the set of protocols whose conformances will be
785+
/// associated with this declaration context.
786+
///
787+
/// This function differs from \c getLocalConformances() in that it
788+
/// returns protocol declarations, not protocol conformances, and
789+
/// therefore does not require the protocol conformances to be
790+
/// formed.
791+
///
792+
/// \param lookupKind The kind of lookup to perform.
793+
SmallVector<ProtocolDecl *, 2>
794+
getLocalProtocols(ConformanceLookupKind lookupKind
795+
= ConformanceLookupKind::All) const;
796+
797+
/// Retrieve the set of protocol conformances associated with this
798+
/// declaration context.
799+
///
800+
/// \param lookupKind The kind of lookup to perform.
801+
SmallVector<ProtocolConformance *, 2>
802+
getLocalConformances(ConformanceLookupKind lookupKind
803+
= ConformanceLookupKind::All) const;
804+
805+
/// Retrieve diagnostics discovered while expanding conformances for this
806+
/// declaration context. This operation then removes those diagnostics from
807+
/// consideration, so subsequent calls to this function with the same
808+
/// declaration context that have not had any new extensions bound
809+
/// will see an empty array.
810+
SmallVector<ConformanceDiagnostic, 4> takeConformanceDiagnostics() const;
811+
818812
/// Return 'this' as a \c Decl.
819813
const Decl *getDecl() const;
820814

815+
/// Return 'this' as a \c GenericContext.
816+
const GenericContext *getAsGenericContext() const;
817+
821818
/// Get the DeclID this Decl was deserialized from.
822819
serialization::DeclID getDeclID() const {
823820
assert(wasDeserialized());

include/swift/AST/Expr.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4227,9 +4227,7 @@ class DefaultArgumentExpr final : public Expr {
42274227
DefaultArgsOwner(defaultArgsOwner), ParamIndex(paramIndex), Loc(loc),
42284228
ContextOrCallerSideExpr(dc) { }
42294229

4230-
SourceRange getSourceRange() const { return {}; }
4231-
4232-
SourceLoc getArgumentListLoc() const { return Loc; }
4230+
SourceRange getSourceRange() const { return Loc; }
42334231

42344232
ConcreteDeclRef getDefaultArgsOwner() const {
42354233
return DefaultArgsOwner;

include/swift/AST/TypeCheckRequests.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,8 @@ void simple_display(llvm::raw_ostream &out, ConformanceLookupKind kind);
22592259
/// must also be reported so it can be checked as well.
22602260
class LookupAllConformancesInContextRequest
22612261
: public SimpleRequest<LookupAllConformancesInContextRequest,
2262-
ProtocolConformanceLookupResult(const DeclContext *),
2262+
ProtocolConformanceLookupResult(
2263+
const IterableDeclContext *),
22632264
RequestFlags::Uncached |
22642265
RequestFlags::DependencySink |
22652266
RequestFlags::DependencySource> {
@@ -2271,7 +2272,7 @@ class LookupAllConformancesInContextRequest
22712272

22722273
// Evaluation.
22732274
ProtocolConformanceLookupResult
2274-
evaluate(Evaluator &evaluator, const DeclContext *DC) const;
2275+
evaluate(Evaluator &evaluator, const IterableDeclContext *IDC) const;
22752276

22762277
public:
22772278
// Incremental dependencies
@@ -2429,6 +2430,32 @@ class ResolveTypeRequest
24292430
void simple_display(llvm::raw_ostream &out, const TypeResolution *resolution);
24302431
SourceLoc extractNearestSourceLoc(const TypeRepr *repr);
24312432

2433+
/// Checks to see if any of the imports in a module use `@_implementationOnly`
2434+
/// in one file and not in another.
2435+
///
2436+
/// Like redeclaration checking, but for imports.
2437+
///
2438+
/// This is a request purely to ensure that we don't need to perform the same
2439+
/// checking for each file we resolve imports for.
2440+
/// FIXME: Once import resolution operates at module-level, this checking can
2441+
/// integrated into it.
2442+
class CheckInconsistentImplementationOnlyImportsRequest
2443+
: public SimpleRequest<CheckInconsistentImplementationOnlyImportsRequest,
2444+
evaluator::SideEffect(ModuleDecl *),
2445+
RequestFlags::Cached> {
2446+
public:
2447+
using SimpleRequest::SimpleRequest;
2448+
2449+
private:
2450+
friend SimpleRequest;
2451+
2452+
evaluator::SideEffect evaluate(Evaluator &evaluator, ModuleDecl *mod) const;
2453+
2454+
public:
2455+
// Cached.
2456+
bool isCached() const { return true; }
2457+
};
2458+
24322459
// Allow AnyValue to compare two Type values, even though Type doesn't
24332460
// support ==.
24342461
template<>

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ SWIFT_REQUEST(TypeChecker, AttachedPropertyWrappersRequest,
2929
NoLocationInfo)
3030
SWIFT_REQUEST(TypeChecker, CallerSideDefaultArgExprRequest,
3131
Expr *(DefaultArgumentExpr *), SeparatelyCached, NoLocationInfo)
32+
SWIFT_REQUEST(TypeChecker, CheckInconsistentImplementationOnlyImportsRequest,
33+
evaluator::SideEffect(ModuleDecl *), Cached, NoLocationInfo)
3234
SWIFT_REQUEST(TypeChecker, CheckRedeclarationRequest,
3335
evaluator::SideEffect(ValueDecl *),
3436
Uncached, NoLocationInfo)
@@ -256,7 +258,7 @@ SWIFT_REQUEST(TypeChecker, ScopedImportLookupRequest,
256258
SWIFT_REQUEST(TypeChecker, ClosureHasExplicitResultRequest,
257259
bool(ClosureExpr *), Cached, NoLocationInfo)
258260
SWIFT_REQUEST(TypeChecker, LookupAllConformancesInContextRequest,
259-
ProtocolConformanceLookupResult(const DeclContext *),
261+
ProtocolConformanceLookupResult(const IterableDeclContext *),
260262
Uncached, NoLocationInfo)
261263
SWIFT_REQUEST(TypeChecker, SimpleDidSetRequest,
262264
bool(AccessorDecl *), Cached, NoLocationInfo)

include/swift/Basic/LLVM.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ namespace llvm {
4545
template<typename T> class MutableArrayRef;
4646
#endif
4747
template<typename T> class TinyPtrVector;
48+
#if !defined(swiftCore_EXPORTS)
4849
template<typename T> class Optional;
50+
#endif
4951
template <typename ...PTs> class PointerUnion;
5052
template <typename IteratorT> class iterator_range;
5153
class SmallBitVector;
@@ -75,7 +77,9 @@ namespace swift {
7577
#endif
7678
using llvm::iterator_range;
7779
using llvm::None;
80+
#if !defined(swiftCore_EXPORTS)
7881
using llvm::Optional;
82+
#endif
7983
using llvm::PointerUnion;
8084
using llvm::SmallBitVector;
8185
using llvm::SmallPtrSet;

include/swift/Basic/LangOptions.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -484,11 +484,7 @@ namespace swift {
484484
/// 4.2 GHz Intel Core i7.
485485
/// (It's arbitrary, but will keep the compiler from taking too much time.)
486486
unsigned SwitchCheckingInvocationThreshold = 200000;
487-
488-
/// Whether to delay checking that benefits from having the entire
489-
/// module parsed, e.g., Objective-C method override checking.
490-
bool DelayWholeModuleChecking = false;
491-
487+
492488
/// If true, the time it takes to type-check each function will be dumped
493489
/// to llvm::errs().
494490
bool DebugTimeFunctionBodies = false;
@@ -497,11 +493,6 @@ namespace swift {
497493
/// dumped to llvm::errs().
498494
bool DebugTimeExpressions = false;
499495

500-
/// Indicate that the type checker is checking code that will be
501-
/// immediately executed. This will suppress certain warnings
502-
/// when executing scripts.
503-
bool InImmediateMode = false;
504-
505496
/// Indicate that the type checker should skip type-checking non-inlinable
506497
/// function bodies.
507498
bool SkipNonInlinableFunctionBodies = false;

include/swift/Basic/STLExtras.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -528,19 +528,18 @@ makeOptionalTransformRange(Range range, OptionalTransform op) {
528528
/// the result in an optional to indicate success or failure.
529529
template<typename Subclass>
530530
struct DowncastAsOptional {
531-
template<typename Superclass>
531+
template <typename Superclass>
532532
auto operator()(Superclass &value) const
533-
-> Optional<decltype(llvm::cast<Subclass>(value))> {
533+
-> llvm::Optional<decltype(llvm::cast<Subclass>(value))> {
534534
if (auto result = llvm::dyn_cast<Subclass>(value))
535535
return result;
536536

537537
return None;
538538
}
539539

540-
template<typename Superclass>
540+
template <typename Superclass>
541541
auto operator()(const Superclass &value) const
542-
-> Optional<decltype(llvm::cast<Subclass>(value))>
543-
{
542+
-> llvm::Optional<decltype(llvm::cast<Subclass>(value))> {
544543
if (auto result = llvm::dyn_cast<Subclass>(value))
545544
return result;
546545

0 commit comments

Comments
 (0)