Skip to content

Commit b222135

Browse files
Merge pull request #5265 from swiftwasm/main
[pull] swiftwasm from main
2 parents dad20d8 + cfad960 commit b222135

File tree

100 files changed

+1465
-403
lines changed

Some content is hidden

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

100 files changed

+1465
-403
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -440,16 +440,16 @@ set(SWIFT_DARWIN_STDLIB_INSTALL_NAME_DIR "/usr/lib/swift" CACHE STRING
440440
set(SWIFT_DARWIN_STDLIB_PRIVATE_INSTALL_NAME_DIR "@rpath" CACHE STRING
441441
"The directory of the install_name for the private standard library dylibs")
442442

443-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.9" CACHE STRING
443+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_OSX "10.13" CACHE STRING
444444
"Minimum deployment target version for OS X")
445445

446-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "7.0" CACHE STRING
446+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_IOS "11.0" CACHE STRING
447447
"Minimum deployment target version for iOS")
448448

449-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "9.0" CACHE STRING
449+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS "11.0" CACHE STRING
450450
"Minimum deployment target version for tvOS")
451451

452-
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "2.0" CACHE STRING
452+
set(SWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS "4.0" CACHE STRING
453453
"Minimum deployment target version for watchOS")
454454

455455
#

SwiftCompilerSources/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The bootstrapping mode is cached in the `CMakeCache.txt` file in the Swift build
2424

2525
### Bootstrapping
2626

27-
The bootstrapping process is completely implemented with CMake dependencies. The build-script is not required to build the whole bootstrapping chain. For example, a `ninja swift-frontend` invocation builds all the required bootstrapping steps required for the final `swift-frontend`.
27+
The bootstrapping process is completely implemented with CMake dependencies. The build-script is not required to build the whole bootstrapping chain. For example, a `ninja bin/swift-frontend` invocation builds all the required bootstrapping steps required for the final `swift-frontend`.
2828

2929
Bootstrapping involves the following steps:
3030

cmake/modules/SwiftConfigureSDK.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ function(remove_sdk_unsupported_archs name os sdk_path architectures_var)
8484
# 32-bit iOS simulator is not listed explicitly in SDK settings.
8585
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
8686
list(APPEND architectures ${arch})
87+
elseif(arch STREQUAL "armv7k" AND os STREQUAL "watchos")
88+
# 32-bit watchOS is not listed explicitly in SDK settings.
89+
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
90+
list(APPEND architectures ${arch})
91+
elseif(arch STREQUAL "i386" AND os STREQUAL "watchsimulator")
92+
# 32-bit watchOS simulator is not listed explicitly in SDK settings.
93+
message(STATUS "Assuming ${name} SDK at ${sdk_path} supports architecture ${arch}")
94+
list(APPEND architectures ${arch})
8795
else()
8896
message(STATUS "${name} SDK at ${sdk_path} does not support architecture ${arch}")
8997
endif()

docs/DevelopmentTips.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ DYLD_LIBRARY_PATH=/Library/Developer/Toolchains/swift-LOCAL-YYYY-MM-DD.xctoolcha
4545
### Working with two build directories
4646
For developing and debugging you are probably building a debug configuration of swift. But it's often beneficial to also build a release-assert configuration in parallel (`utils/build-script -R`).
4747

48-
The standard library takes very long to build with a debug compiler. It's much faster to build everything (including the standard library) with a release compiler and only the swift-frontend (with `ninja swift-frontend`) in debug. Then copy the release-built standard library to the debug build:
48+
The standard library takes very long to build with a debug compiler. It's much faster to build everything (including the standard library) with a release compiler and only the swift-frontend (with `ninja bin/swift-frontend`) in debug. Then copy the release-built standard library to the debug build:
4949
```
5050
src=/path/to/build/Ninja-ReleaseAssert/swift-macosx-x86_64
5151
dst=/path/to/build/Ninja-DebugAssert/swift-macosx-x86_64

docs/HowToGuides/FAQ.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ The general idea is to build as little as you can.
1818
aren't doing so already.
1919
- Use `build-script`'s various `--skip-*` flags to skip configuring for
2020
platforms that you do not care about.
21-
- If you're on macOS, use `--swift-darwin-supported-archs="x86_64"`.
22-
- Use a release build without assertions (`--release --no-assertions`).
23-
While debuginfo and assertions are valuable to enable when working on the
21+
- If you're on macOS, use `--swift-darwin-supported-archs "$(uname -m)"`.
22+
- Build the release variant without assertions (`--release --no-assertions`).
23+
While debug info and assertions are valuable to enable when working on the
2424
toolchain itself, they are not so useful if you are working only on changes
2525
to the build system.
2626

docs/HowToGuides/GettingStarted.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,16 @@ Phew, that's a lot to digest! Now let's proceed to the actual build itself!
250250
```
251251
If you installed and want to use Sccache, include the `--sccache` option in
252252
the invocation as well.
253+
<!-- FIXME: Without this "hard" line break, the note doesn’t get properly spaced from the bullet -->
254+
<br />
253255
254256
> **Note**
255-
> If you aren't planning to edit the parts of the compiler that are written
256-
> in Swift, pass `--bootstrapping=hosttools` to speed up local development.
257-
> This requires a recent Xcode and/or swift toolchain to be installed.
257+
> If you are planning to work on the compiler, but not the parts that are
258+
> written in Swift, pass `--bootstrapping=hosttools` to speed up local
259+
> development. Note that on Linux — unlike macOS, where the toolchain already
260+
> comes with Xcode — this option additionally requires
261+
> [a recent Swift toolchain](https://www.swift.org/download/) to be
262+
> installed.
258263
259264
This will create a directory `swift-project/build/Ninja-RelWithDebInfoAssert`
260265
containing the Swift compiler and standard library and clang/LLVM build artifacts.
@@ -271,9 +276,8 @@ Phew, that's a lot to digest! Now let's proceed to the actual build itself!
271276
on Linux, add the `--xctest` flag to `build-script`.
272277
273278
In the following sections, for simplicity, we will assume that you are using a
274-
`Ninja-RelWithDebInfoAssert` build on macOS running on an Intel-based Mac,
275-
unless explicitly mentioned otherwise. You will need to slightly tweak the paths
276-
for other build configurations.
279+
`Ninja-RelWithDebInfoAssert` build on macOS, unless explicitly mentioned otherwise.
280+
You will need to slightly tweak the paths for other build configurations.
277281
278282
### Troubleshooting build issues
279283
@@ -360,13 +364,13 @@ several more steps are necessary to set up this environment:
360364
* Create a new Xcode workspace.
361365
* Add the generated Xcode projects or Swift packages that are relevant to your
362366
tasks to your workspace. All the Xcode projects can be found among the
363-
build artifacts under `build/Xcode-ReleaseAssert`. For example:
364-
* If you are aiming for the compiler, add `build/Xcode-ReleaseAssert/swift-macosx-*/Swift.xcodeproj`.
367+
build artifacts under `build/Xcode-*/`. For example:
368+
* If you are aiming for the compiler, add `build/Xcode-*/swift-macosx-*/Swift.xcodeproj`.
365369
This project also includes the standard library and runtime sources. If you
366370
need the parts of the compiler that are implemented in Swift itself, add the
367371
`swift/SwiftCompilerSources/Package.swift` package as well.
368372
* If you are aiming for just the standard library or runtime, add
369-
`build/Xcode-ReleaseAssert/swift-macosx-*/stdlib/Swift-stdlib.xcodeproj`.
373+
`build/Xcode-*/swift-macosx-*/stdlib/Swift-stdlib.xcodeproj`.
370374
<!-- FIXME: Without this "hard" line break, the note doesn’t get properly spaced from the bullet -->
371375
<br />
372376

include/swift/AST/Attr.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2314,25 +2314,31 @@ class MacroRoleAttr final
23142314
MacroSyntax syntax;
23152315
MacroRole role;
23162316
unsigned numNames;
2317+
SourceLoc lParenLoc, rParenLoc;
23172318

23182319
MacroRoleAttr(SourceLoc atLoc, SourceRange range, MacroSyntax syntax,
2319-
MacroRole role, ArrayRef<MacroIntroducedDeclName> names,
2320-
bool implicit);
2320+
SourceLoc lParenLoc, MacroRole role,
2321+
ArrayRef<MacroIntroducedDeclName> names,
2322+
SourceLoc rParenLoc, bool implicit);
23212323

23222324
public:
23232325
static MacroRoleAttr *create(ASTContext &ctx, SourceLoc atLoc,
23242326
SourceRange range, MacroSyntax syntax,
2325-
MacroRole role,
2327+
SourceLoc lParenLoc, MacroRole role,
23262328
ArrayRef<MacroIntroducedDeclName> names,
2327-
bool implicit);
2329+
SourceLoc rParenLoc, bool implicit);
23282330

23292331
size_t numTrailingObjects(OverloadToken<MacroIntroducedDeclName>) const {
23302332
return numNames;
23312333
}
23322334

2335+
SourceLoc getLParenLoc() const { return lParenLoc; }
2336+
SourceLoc getRParenLoc() const { return rParenLoc; }
2337+
23332338
MacroSyntax getMacroSyntax() const { return syntax; }
23342339
MacroRole getMacroRole() const { return role; }
23352340
ArrayRef<MacroIntroducedDeclName> getNames() const;
2341+
bool hasNameKind(MacroIntroducedDeclNameKind kind) const;
23362342

23372343
static bool classof(const DeclAttribute *DA) {
23382344
return DA->getKind() == DAK_MacroRole;

include/swift/AST/Decl.h

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8440,6 +8440,9 @@ class MacroDecl : public GenericContext, public ValueDecl {
84408440
/// Determine the contexts in which this macro can be applied.
84418441
MacroRoles getMacroRoles() const;
84428442

8443+
/// Retrieve the attribute that declared the given macro role.
8444+
const MacroRoleAttr *getMacroRoleAttr(MacroRole role) const;
8445+
84438446
/// Retrieve the definition of this macro.
84448447
MacroDefinition getDefinition() const;
84458448

@@ -8464,12 +8467,11 @@ class MacroDecl : public GenericContext, public ValueDecl {
84648467

84658468
class MacroExpansionDecl : public Decl {
84668469
SourceLoc PoundLoc;
8467-
DeclNameRef Macro;
8468-
DeclNameLoc MacroLoc;
8470+
DeclNameRef MacroName;
8471+
DeclNameLoc MacroNameLoc;
84698472
SourceLoc LeftAngleLoc, RightAngleLoc;
84708473
ArrayRef<TypeRepr *> GenericArgs;
84718474
ArgumentList *ArgList;
8472-
ArrayRef<Decl *> Rewritten;
84738475

84748476
/// The referenced macro.
84758477
ConcreteDeclRef macroRef;
@@ -8484,9 +8486,9 @@ class MacroExpansionDecl : public Decl {
84848486
SourceLoc rightAngleLoc,
84858487
ArgumentList *args)
84868488
: Decl(DeclKind::MacroExpansion, dc), PoundLoc(poundLoc),
8487-
Macro(macro), MacroLoc(macroLoc),
8489+
MacroName(macro), MacroNameLoc(macroLoc),
84888490
LeftAngleLoc(leftAngleLoc), RightAngleLoc(rightAngleLoc),
8489-
GenericArgs(genericArgs), ArgList(args), Rewritten({}) {
8491+
GenericArgs(genericArgs), ArgList(args) {
84908492
Bits.MacroExpansionDecl.Discriminator = InvalidDiscriminator;
84918493
}
84928494

@@ -8499,11 +8501,10 @@ class MacroExpansionDecl : public Decl {
84998501
SourceRange getSourceRange() const;
85008502
SourceLoc getLocFromSource() const { return PoundLoc; }
85018503
SourceLoc getPoundLoc() const { return PoundLoc; }
8502-
DeclNameLoc getMacroLoc() const { return MacroLoc; }
8503-
DeclNameRef getMacro() const { return Macro; }
8504+
DeclNameLoc getMacroNameLoc() const { return MacroNameLoc; }
8505+
DeclNameRef getMacroName() const { return MacroName; }
85048506
ArgumentList *getArgs() const { return ArgList; }
8505-
ArrayRef<Decl *> getRewritten() const { return Rewritten; }
8506-
void setRewritten(ArrayRef<Decl *> rewritten) { Rewritten = rewritten; }
8507+
ArrayRef<Decl *> getRewritten() const;
85078508
ConcreteDeclRef getMacroRef() const { return macroRef; }
85088509
void setMacroRef(ConcreteDeclRef ref) { macroRef = ref; }
85098510

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6918,7 +6918,7 @@ ERROR(macro_definition_unsupported,none,
69186918
"macro definitions other than '#externalMacro(...)' are unsupported", ())
69196919
ERROR(external_macro_arg_not_type_name,none,
69206920
"argument to `#externalMacro` must be a string literal naming "
6921-
"the external macro's %select{module|type}", (unsigned))
6921+
"the external macro's %select{module|type}0", (unsigned))
69226922
ERROR(attached_declaration_macro_not_supported,none,
69236923
"attached declaration macros are not yet supported", ())
69246924

@@ -6938,6 +6938,8 @@ ERROR(moveonly_cannot_conform_to_protocol, none,
69386938
ERROR(moveonly_cannot_conform_to_protocol_with_name, none,
69396939
"move-only %0 %1 cannot conform to protocol %2",
69406940
(DescriptiveDeclKind, DeclName, DeclName))
6941+
ERROR(moveonly_non_final_class_cannot_contain_moveonly_field, none,
6942+
"non-final classes containing move only fields is not yet supported", ())
69416943

69426944
//------------------------------------------------------------------------------
69436945
// MARK: Runtime discoverable attributes (@runtimeMetadata)

include/swift/AST/TypeCheckRequests.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3103,7 +3103,8 @@ class LookupAllConformancesInContextRequest
31033103

31043104
class CheckRedeclarationRequest
31053105
: public SimpleRequest<
3106-
CheckRedeclarationRequest, evaluator::SideEffect(ValueDecl *),
3106+
CheckRedeclarationRequest,
3107+
evaluator::SideEffect(ValueDecl *, NominalTypeDecl *),
31073108
RequestFlags::SeparatelyCached | RequestFlags::DependencySource |
31083109
RequestFlags::DependencySink> {
31093110
public:
@@ -3113,10 +3114,13 @@ class CheckRedeclarationRequest
31133114
friend SimpleRequest;
31143115

31153116
// Evaluation.
3116-
evaluator::SideEffect
3117-
evaluate(Evaluator &evaluator, ValueDecl *VD) const;
3117+
/// \p SelfNominalType is \c VD->getDeclContext()->getSelfNominalType().
3118+
/// Passed as a parameter in here so this request doesn't tigger self nominal
3119+
/// type computation.
3120+
evaluator::SideEffect evaluate(Evaluator &evaluator, ValueDecl *VD,
3121+
NominalTypeDecl *SelfNominalType) const;
31183122

3119-
public:
3123+
public:
31203124
// Separate caching.
31213125
bool isCached() const { return true; }
31223126
Optional<evaluator::SideEffect> getCachedResult() const;

0 commit comments

Comments
 (0)