Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")
#
# Primary variant is always OSX; even on iOS hosts.
set(SWIFT_PRIMARY_VARIANT_SDK_default "OSX")
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${CMAKE_HOST_SYSTEM_PROCESSOR}")

endif()

Expand Down
11 changes: 6 additions & 5 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ The following build options are available:
The following build targets are available:

* `swift-benchmark-macosx-x86_64`
* `swift-benchmark-macosx-arm64`
* `swift-benchmark-iphoneos-arm64e`
* `swift-benchmark-iphoneos-arm64`
* `swift-benchmark-iphoneos-armv7`
Expand All @@ -84,7 +85,7 @@ Build steps (with example options):

1. `$ mkdir build; cd build`
2. `$ cmake [path to swift src]/benchmark -G Ninja -DSWIFT_EXEC=[path to built swiftc]`
3. `$ ninja swift-benchmark-macosx-x86_64`
3. `$ ninja swift-benchmark-macosx-$(uname -m)`

Benchmark binaries are placed in `bin`.

Expand All @@ -98,7 +99,7 @@ relative to the benchmark binary at the time it was executed
For example, to benchmark against a locally built `swiftc`, including
any standard library changes in that build, you might configure using:

cmake <src>/benchmark -G Ninja -DSWIFT_EXEC=<build>/swift-macosx-x86_64/bin/swiftc
cmake <src>/benchmark -G Ninja -DSWIFT_EXEC=<build>/swift-macosx-$(uname -m)/bin/swiftc
ninja swift-benchmark-iphoneos-arm64

To build against the installed Xcode, simply omit SWIFT_EXEC:
Expand Down Expand Up @@ -319,12 +320,12 @@ swift-source$ ./swift/utils/build-script -R -B
````
you can rebuild just the benchmarks:
````
swift-source$ export SWIFT_BUILD_DIR=`pwd`/build/Ninja-ReleaseAssert/swift-macosx-x86_64
swift-source$ ninja -C ${SWIFT_BUILD_DIR} swift-benchmark-macosx-x86_64
swift-source$ export SWIFT_BUILD_DIR=`pwd`/build/Ninja-ReleaseAssert/swift-macosx-$(uname -m)
swift-source$ ninja -C ${SWIFT_BUILD_DIR} swift-benchmark-macosx-$(uname -m)
````

When modifying the testing infrastructure, you should verify that your changes
pass all the tests:
````
swift-source$ ./llvm/utils/lit/lit.py -sv ${SWIFT_BUILD_DIR}/test-macosx-x86_64/benchmark
swift-source$ ./llvm/utils/lit/lit.py -sv ${SWIFT_BUILD_DIR}/test-macosx-$(uname -m)/benchmark
````
6 changes: 3 additions & 3 deletions docs/DebuggingTheCompiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -875,14 +875,14 @@ well as cleanups/modernizations on a code-base. Swift's cmake invocation by
default creates one of these json databases at the root path of the swift host
build, for example on macOS:

$PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json
$PATH_TO_BUILD/swift-macosx-$(uname -m)/compile_commands.json

Using this file, one invokes `clang-tidy` on a specific file in the codebase
as follows:

clang-tidy -p=$PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json $FULL_PATH_TO_FILE
clang-tidy -p=$PATH_TO_BUILD/swift-macosx-$(uname -m)/compile_commands.json $FULL_PATH_TO_FILE

One can also use shell regex to visit multiple files in the same directory. Example:

clang-tidy -p=$PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json $FULL_PATH_TO_DIR/*.cpp
clang-tidy -p=$PATH_TO_BUILD/swift-macosx-$(uname -m)/compile_commands.json $FULL_PATH_TO_DIR/*.cpp

21 changes: 11 additions & 10 deletions docs/HowToGuides/GettingStarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,13 @@ Phew, that's a lot to digest! Now let's proceed to the actual build itself!
- Via Ninja:
```sh
utils/build-script --skip-build-benchmarks \
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "x86_64" \
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
--sccache --release-debuginfo --test
```
- Via Xcode:
```sh
utils/build-script --skip-build-benchmarks \
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "x86_64" \
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
--sccache --release-debuginfo --test \
--xcode
```
Expand Down Expand Up @@ -350,7 +350,8 @@ git push --set-upstream my-remote my-branch
### First time Xcode setup

If you used `--xcode` earlier, you will see an Xcode project generated under
`../build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64`. When you open the
`../build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64` (or
`../build/Xcode-RelWithDebInfoAssert/swift-macosx-arm64` on Apple Silicon Macs). When you open the
project, Xcode might helpfully suggest "Automatically Create Schemes". Most of
those schemes are not required in day-to-day work, so you can instead manually
select the following schemes:
Expand All @@ -375,12 +376,12 @@ Now that you have made some changes, you will need to rebuild...

To rebuild the compiler:
```sh
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64 swift-frontend
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m) swift-frontend
```

To rebuild everything, including the standard library:
```sh
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64
ninja -C ../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)
```

### Incremental builds with Xcode
Expand All @@ -396,7 +397,7 @@ build should be much faster than the from-scratch build at the beginning.
Now check if the version string has been updated:

```sh
../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/bin/swift-frontend --version
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/bin/swift-frontend --version
```

This should print your updated version string.
Expand Down Expand Up @@ -439,22 +440,22 @@ There are two main ways to run tests:
```sh
# Rebuild all test dependencies and run all tests under test/.
utils/run-test --lit ../llvm-project/llvm/utils/lit/lit.py \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/test-macosx-$(uname -m)

# Rebuild all test dependencies and run tests containing "MyTest".
utils/run-test --lit ../llvm-project/llvm/utils/lit/lit.py \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64 \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/test-macosx-$(uname -m) \
--filter="MyTest"
```
2. `lit.py`: lit doesn't know anything about dependencies. It just runs tests.
```sh
# Run all tests under test/.
../llvm-project/llvm/utils/lit/lit.py -s -vv \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/test-macosx-$(uname -m)

# Run tests containing "MyTest"
../llvm-project/llvm/utils/lit/lit.py -s -vv \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64 \
../build/Ninja-RelWithDebInfoAssert/swift-macosx-$(uname -m)/test-macosx-$(uname -m) \
--filter="MyTest"
```
The `-s` and `-vv` flags print a progress bar and the executed commands
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -target x86_64-apple-macosx10.15 %s
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -target %target-cpu-apple-macosx10.15 %s

// REQUIRES: OS=macosx

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -target x86_64-apple-macosx10.15 -application-extension %s
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -verify -I %S/Inputs/custom-modules -target %target-cpu-apple-macosx10.15 -application-extension %s

// REQUIRES: OS=macosx

Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/fixed_class_initialization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %target-swift-frontend -target x86_64-apple-macosx10.14 -module-name main -emit-ir %s | %FileCheck --check-prefix=CHECK --check-prefix=NO_OPT_SELF %s

// REQUIRES: objc_interop
// REQUIRES: OS=macosx
// REQUIRES: OS=macosx && CPU=x86_64

class C {
var x: Int = 0
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/macosx-sdk-version.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend %s -target x86_64-apple-macosx10.14 -target-sdk-version 10.15.4 -emit-ir | %FileCheck %s
// RUN: %target-swift-frontend %s -target %target-cpu-apple-macosx10.14 -target-sdk-version 10.15.4 -emit-ir | %FileCheck %s

// REQUIRES: OS=macosx

Expand Down
4 changes: 2 additions & 2 deletions test/IRGen/opaque_result_type_availability.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %target-swift-frontend -enable-implicit-dynamic -target x86_64-apple-macosx10.9 -Onone -emit-ir %s | %FileCheck --check-prefix=MAYBE-AVAILABLE %s
// RUN: %target-swift-frontend -enable-implicit-dynamic -target %target-cpu-apple-macosx10.9 -Onone -emit-ir %s | %FileCheck --check-prefix=MAYBE-AVAILABLE %s
// RUN: %target-swift-frontend -enable-implicit-dynamic -target %target-cpu-apple-macosx10.15 -Onone -emit-ir %s | %FileCheck --check-prefix=ALWAYS-AVAILABLE %s
// REQUIRES: OS=macosx
// REQUIRES: OS=macosx && CPU=x86_64

protocol P {}
extension Int: P {}
Expand Down
3 changes: 3 additions & 0 deletions test/Sanitizers/tsan-emptyarraystorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// REQUIRES: foundation
// UNSUPPORTED: OS=tvos

// rdar://problem/75006869
// XFAIL: OS=macosx && CPU=arm64

import Foundation

let sem = DispatchSemaphore(value: 0)
Expand Down
3 changes: 3 additions & 0 deletions test/Sanitizers/tsan-libdispatch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// don't support TSan.
// UNSUPPORTED: remote_run

// rdar://problem/75006869
// XFAIL: OS=macosx && CPU=arm64

// Test ThreadSanitizer execution end-to-end with libdispatch.

import Dispatch
Expand Down
3 changes: 3 additions & 0 deletions test/Sanitizers/tsan-norace-block-release.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// don't support TSan.
// UNSUPPORTED: remote_run

// rdar://problem/75006869
// UNSUPPORTED: OS=macosx && CPU=arm64

// Test that we do not report a race on block release operation.
import Dispatch
#if canImport(Darwin)
Expand Down
3 changes: 3 additions & 0 deletions test/Sanitizers/tsan-norace-deinit-run-time.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// don't support TSan.
// UNSUPPORTED: remote_run

// rdar://problem/75006869
// XFAIL: OS=macosx && CPU=arm64

// Test that we do not report a race on deinit; the synchronization is guaranteed by runtime.
import Dispatch
#if canImport(Darwin)
Expand Down
1 change: 0 additions & 1 deletion test/Sanitizers/tsan-static-exclusivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// don't support TSan.
// UNSUPPORTED: remote_run


struct OtherStruct {
mutating
func mutableTakingClosure(_ c: () -> Void) { }
Expand Down
3 changes: 3 additions & 0 deletions test/Sanitizers/tsan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// UNSUPPORTED: OS=tvos
// UNSUPPORTED: CPU=powerpc64le

// rdar://problem/75006869
// XFAIL: OS=macosx && CPU=arm64

// FIXME: This should be covered by "tsan_runtime"; older versions of Apple OSs
// don't support TSan.
// UNSUPPORTED: remote_run
Expand Down
3 changes: 3 additions & 0 deletions test/stdlib/Reflection_objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// REQUIRES: executable_test
// REQUIRES: objc_interop

// rdar://problem/75006694
// XFAIL: OS=macosx && CPU=arm64

//
// DO NOT add more tests to this file. Add them to test/1_stdlib/Runtime.swift.
//
Expand Down
5 changes: 5 additions & 0 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,11 @@ install-swiftpm
install-swift-driver
install-libcxx

[preset: buildbot_incremental,tools=RA,stdlib=RA,apple_silicon]
mixin-preset=buildbot_incremental,tools=RA,stdlib=RA

swift-darwin-supported-archs=arm64

[preset: buildbot_incremental,tools=RA,stdlib=RA,xcode]
mixin-preset=buildbot_incremental,tools=RA,stdlib=RA
build-subdir=buildbot_incremental_xcode
Expand Down
3 changes: 2 additions & 1 deletion utils/coverage/coverage-generate-data
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import logging
import multiprocessing
import os
import pipes
import platform
import subprocess
import sys
import timeit
Expand Down Expand Up @@ -100,7 +101,7 @@ def dump_coverage_data(merged_file):
"""Dump coverage data of file at path `merged_file` using llvm-cov"""
try:
swift = os.path.join(global_build_subdir,
'swift-macosx-x86_64/bin/swift')
'swift-macosx-{}/bin/swift'.format(platform.machine()))
coverage_log = os.path.join(os.path.dirname(merged_file),
'coverage.log')
testname = os.path.basename(os.path.dirname(merged_file))
Expand Down