Commit Graph

86 Commits

Author SHA1 Message Date
Evan Wilde
bb2fe7e4ec Add missing compat libraries to bootstrapping
The bootstrapping stages were missing dependencies on the Concurrency
and Swift 5.6 backdeployment compatibility libraries resulting in
failing builds.
2022-08-08 17:08:40 -07:00
Alex Hoppen
c096c7e975 [CMake] Use CMAKE_CURRENT_SOURCE_DIR as base for includes in SwiftCompilerSources
When using a unified LLVM + Swift build (using `LLVM_EXTERNAL_PROJECTS=swift`),
`CMAKE_SOURCE_DIR` is `llvm-project/llvm`, and appending `include/swift` to that directory doesn’t result in the directory that contains Swift’s header files.

Instead, look up the header files relative to `CMAKE_CURRENT_SOURCE_DIR`.
2022-08-02 22:08:11 +02:00
Erik Eckstein
e796fc8680 cmake: add a hack to get correct dependencies from C++ header files -> Swift compiler sources 2022-07-29 10:55:13 +02:00
Alex Hoppen
259c1b7148 [CMake] Use CMAKE_CURRENT_BINARY_DIR as base for generated C header for SwiftCompilerSources
When using a unified LLVM + Swift build (using `LLVM_EXTERNAL_PROJECTS=swift`), swift is installed into `build_dir/tools/swift`. Thus, we also need to find the generated headers inside the `tools/swift/include` directory and not at the top-level `build_dir/include` directory.
2022-07-18 14:24:38 +02:00
Egor Zhdan
71706d8bd2 Merge pull request #59102 from apple/egorzhdan/libswift-no-backport
[SwiftCompilerSources][build] Fix build with `SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT=NO`
2022-07-05 11:47:14 +01:00
Egor Zhdan
b8e2f2eacc Merge pull request #58699 from apple/egorzhdan/libswift-sourceloc
[cxx-interop][SwiftCompilerSources] Use `swift::SourceLoc` instead of `BridgedSourceLoc`
2022-06-22 10:54:59 +01:00
Zoe Carver
59a9e282cd Merge pull request #59510 from zoecarver/remove-enable-interop-pt-2 2022-06-16 21:40:21 -07:00
zoecarver
57f721a2f1 [cxx-interop] Remove "enable-cxx-interop" flag again. 2022-06-16 18:02:24 -07:00
Richard Wei
3396ede366 Merge pull request #42611 from rxwei/string-processing-default
Enable string processing by default.
2022-06-13 11:16:05 -07:00
Richard Wei
94e8f5393e Enable string processing by default.
Make frontend flag `-enable-experimental-string-processing` default to true.
2022-06-12 20:25:16 -07:00
Egor Zhdan
5768aebeee [cxx-interop][SwiftCompilerSources] Add LLVM headers to the include paths
This allows the Swift compiler to find headers like `llvm/Support/Compiler.h` that are used by Swift headers.
2022-06-11 00:13:39 +01:00
Egor Zhdan
aeec2eb2b4 Merge pull request #59316 from apple/egorzhdan/hosttools-require-recent-swift
[SwiftCompilerSources] Require very recent Swift compiler in `HOSTTOOLS` mode
2022-06-10 20:45:41 +01:00
Rintaro Ishizaki
e1412a0978 Merge pull request #59209 from rintaro/syntaxparser-libswift
[SwiftCompilerModules] Link lib_InternalSwiftSyntaxParser to libswift
2022-06-08 15:36:21 -07:00
Egor Zhdan
a8ae273a52 [SwiftCompilerSources] Require very recent Swift compiler in HOSTTOOLS mode
To use new C++ interop features in SwiftCompilerSources, we need a very recent Swift compiler when building with host tools.

This does not affect non-HOSTTOOLS builds.
2022-06-08 17:08:00 +01:00
Rintaro Ishizaki
9f4ce612a2 [SwiftCompilerModules] Link lib_InternalSwiftSyntaxParser to libswift
To use _RegexParser from SwiftSyntax.

* Create 'libswiftCompilerModules_SwiftSyntax.a' which is a subset of
  'libswiftCompilerModules.a'
* Link 'lib_InternalSwiftSyntaxParser' to
  'libswiftCompilerModules_SwiftSyntax.a'
* Factor out swift runtime linking logic in CMake so that dynamic
  libraries can link to Swift runtime, in addition to executables
* Link 'lib_InternalSwiftSyntaxParser' to swift runtime
2022-06-02 12:23:03 -07:00
Egor Zhdan
2b3980b3e2 [SwiftCompilerSources][build] Require recent Swift compiler in HOSTTOOLS mode
Some code in SwiftCompilerSources, especially the parts that use C++ interop, triggers bugs in older versions of the Swift compiler. To make sure that `HOSTTOOLS` builds don't produce obscure compiler errors or crashes, let's require a relatively new Swift compiler for `HOSTTOOLS` build.
2022-05-31 13:35:58 +01:00
Egor Zhdan
b07a0abba0 [SwiftCompilerSources][build] Fix build with SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT=NO
This allows building SwiftCompilerSources with stdlib compatibility disabled.

Fixes errors like this:
```
[699/716] Building swift module Basic
FAILED: bootstrapping1/SwiftCompilerSources/Basic.o /Users/egorzh/Builds.noindex/swift/swift-release/bootstrapping1/SwiftCompilerSources/Basic.o
cd /Volumes/Projects/swift/swift/SwiftCompilerSources && /Users/egorzh/Builds.noindex/swift/swift-release/bootstrapping0/bin/swiftc -c -o /Users/egorzh/Builds.noindex/swift/swift-release/bootstrapping1/SwiftCompilerSources/Basic.o -sdk /Applications/Xcodes/XcodeSummit.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk -target x86_64-apple-macosx10.9 -module-name Basic -emit-module -emit-module-path /Users/egorzh/Builds.noindex/swift/swift-release/bootstrapping1/SwiftCompilerSources/Basic.swiftmodule -parse-as-library /Volumes/Projects/swift/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift /Volumes/Projects/swift/swift/SwiftCompilerSources/Sources/Basic/Utils.swift -wmo -Xfrontend -validate-tbd-against-ir=none -Xfrontend -enable-cxx-interop -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -O -cross-module-optimization -Xcc -I -Xcc /Volumes/Projects/swift/swift/include -Xcc -I -Xcc /Users/egorzh/Builds.noindex/swift/swift-release/include -I /Users/egorzh/Builds.noindex/swift/swift-release/bootstrapping1/SwiftCompilerSources
<unknown>:0: error: IR generation failure: Cannot read legacy layout file at '/Users/egorzh/Builds.noindex/swift/swift-release/bootstrapping0/lib/swift/macosx/layouts-x86_64.yaml'
ninja: build stopped: subcommand failed.
```
2022-05-26 14:52:54 +01:00
John Holdsworth
5381466580 Small refinements? 2022-05-19 16:41:46 +02:00
John Holdsworth
277699bd55 Make force_lib.c --xcode specific. 2022-05-19 07:54:11 +02:00
John Holdsworth
3dc815b0a7 Potential fix for --xcode build on M1. 2022-05-18 13:05:16 +02:00
Rintaro Ishizaki
a9ac0130c0 [SwiftCompilerSources] Make Package.swift static
`Package.swift` in the build directory and symlinking Sources directory
wasn't great for source control and break points. Since C modules doesn't
need the generated headers at this point, make `Package.swift` static
again with a symlink to the string processing source directory.
2022-05-09 10:00:00 -07:00
Rintaro Ishizaki
dad5ae286e Merge pull request #58667 from rintaro/swiftcompiler-package-directory
[SwiftCompilerModules] Configured Package.swift use its own directory
2022-05-05 09:39:32 -07:00
Egor Zhdan
d4ac213bc8 [cxx-interop][SwiftCompilerSources] Fix build error with Xcode 12 2022-05-05 12:55:04 +01:00
Rintaro Ishizaki
537bd07487 [SwiftCompilerModules] Configured Package.swift use its own directory
Previously, it used ${CMAKE_CURRENT_BINARY_DIR} as the package
directory. However, since that directory contains all build artifacts so
opening it in Xcode shows those unnecessary files.

Intead of using ${CMAKE_CURRENT_BINARY_DIR}, create its own directory in
the root build directory.
2022-05-04 11:55:22 -07:00
Egor Zhdan
67a28c78d5 [cxx-interop][SwiftCompilerSources] Enable libstdc++ on platforms that use it
Since libstdc++ doesn't come with a Clang modulemap, Swift provides its own modulemap for libstdc++. This change makes the modulemap available while building SwiftCompilerSources.
2022-05-03 19:48:14 +01:00
Josh Soref
1b0aa6d7f1 Spelling swiftcompilersources (#42617)
* spelling: diagnose

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: diagnostic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intentionally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: optimization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: target

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unbalanced

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-25 09:01:23 -07:00
Rintaro Ishizaki
d292a95296 [SwiftCompiler/Regex] Use bridged DiagnosticEngine for error reporting
This fixes:
 * An issue where the diagnostic messages were leaked
 * Diagnose at correct position inside the regex literal

To do this:
 * Introduce 'Parse' SwiftCompiler module that is a bridging layer
   between '_CompilerRegexParser' and C++ libParse
 * Move libswiftParseRegexLiteral and libswiftLexRegexLiteral to 'Parse'

Also this change makes 'SwiftCompilerSources/Package.swift' be configured
by CMake so it can actually be built with 'swift-build'.

rdar://92187284
2022-04-22 22:53:46 -07:00
Erik Eckstein
9906666801 Fix the 'hosttools' bootstrapping build mode
After the rename of the `enable-cxx-interop` option to `enable-experimental-cxx-interop` it was no longer possible to build with installed tools.
This change re-introduces the `enable-cxx-interop` option for backward compatibility
2022-04-09 10:56:06 +02:00
zoecarver
839839f924 [cxx-interop] Rename enable-cxx-interop -> enable-experimental-cxx-interop.
Also removes the driver flag, this will now also always be guarded on `-Xfrontend`.
2022-04-07 19:15:25 -07:00
Rintaro Ishizaki
7486cd1c21 [SwiftCompiler] Move common bridging facilities to 'Basic'
A preparation for AST/DiagnosticEngine bridging
2022-02-20 22:06:39 -08:00
Erik Eckstein
0d9b364e05 cmake: Fix a dependency problem when compiling swift modules
There was only an ordering dependency between modules but not a file dependency.
This caused missing re-compiles of depending modules in incremental builds.
2022-01-19 17:56:45 +01:00
Casper Jeukendrup
b3ea191817 Support bootstrapping with Xcode
Xcode does not compile libraries that contain only object files; it just skips them completely, not even mentioning them in the logs. Therefore, it fails to create the static library that would contain all SwiftCompilerSources object files. As a workaround, we add a dummy script phase to the target, to force that it gets compiled.
2022-01-14 02:57:04 +01:00
Erik Eckstein
feaeca2039 cmake: fix a cmake error with the Xcode generator
rdar://86285942
2021-12-22 11:31:52 +01:00
Erik Eckstein
3d33f11e6c cmake/build-script: rename the libswift option to "bootstrapping"
In cmake, rename LIBSWIFT_BUILD_MODE to BOOTSTRAPPING_MODE.
Also, rename the lit feature "libswift" to "swift_in_compiler".
2021-12-22 11:31:52 +01:00
Erik Eckstein
ba364a17ef libswift: rename cmake targets and functions
libswift -> swiftCompilerModules or swiftCompilerSources
2021-12-22 11:31:52 +01:00
Erik Eckstein
4beb94c2f9 Rename the libswift directory to SwiftCompilerSources 2021-12-22 09:46:25 +01:00