Commit Graph

2104 Commits

Author SHA1 Message Date
Slava Pestov
c2338aa0f6 Backward deployment shim for swift_allocate{Metadata,WitnessTable}Pack() 2023-05-12 15:44:12 -04:00
Erik Eckstein
85052a1489 deprecate the -experimental-performance-annotations option
Performance annotations can now be used without specifying this option
2023-05-11 08:03:19 +02:00
Allan Shortlidge
c7352728ff Frontend: Introduce stub mode for -unavailable-decl-optimization.
Part of rdar://107388493
2023-05-03 15:19:31 -07:00
Ellie Shin
b081404daa Print package-name in .private.swiftinterface only for better abstraction
Resolves rdar://107638447
2023-04-20 17:45:22 -07:00
Ellie Shin
578c63a372 Merge pull request #65111 from apple/es-str
Allow all unicode characters in package-name input
2023-04-20 17:13:37 -07:00
Ellie Shin
3a4cd362ac Allow all unicode characters in package-name input
Error if the input is empty
Resolves rdar://104617274
2023-04-20 11:16:30 -07:00
Steven Wu
b9f9eeb198 Merge pull request #65058 from cachemeifyoucan/eng/PR-swift-cas-fs
[CAS] Integrate CAS into swift compiler
2023-04-19 09:11:30 -07:00
Steven Wu
e2c494179d [CAS] Integrate CAS into swift compiler
Teach swift compiler about CAS to allow compiler caching in the future.
1) Add flags to initiate CAS inside swift-frontend
2) Teach swift to compile using a CAS file system.
2023-04-17 13:18:09 -07:00
Alejandro Alonso
bd5d24d558 Add AvailabilityMacro feature, kind of 2023-04-16 15:42:14 -07:00
Alexis Laferrière
5080898f9b [Serialization] Disable deserialization safety along with access control
Disabling access control is fundamentally incompatible with
deserialization safety. Let's turn off safety automatically when in use.

This was reported by a few tests:

stdlib/Dictionary.swift
stdlib/Set.swift
stdlib/SetOperations.swift.gyb
stdlib/SwiftNativeNSBase.swift
2023-04-13 13:39:14 -07:00
Xi Ge
1f395ec1a8 Frontend: infer default blocklists to use when the explicit paths aren't given by swift-driver
Although swift-driver always passes down these blocklist for the compiler to consume, some frontend
tools, like ABI checker, are invoked by the build system directly. Therefore, we need to teach
the compiler to infer these blocklist files like prebuilt module cache.
2023-04-11 12:25:07 -07:00
Xi Ge
68e6b22230 ModuleInterface: pass down block list file paths to module interface building context and command lines 2023-04-08 18:29:51 -07:00
Xi Ge
2836ee357b Frontend: pass down blocklist file paths from frontend options. NFC 2023-04-07 21:26:19 -07:00
Dario Rexin
57dc5a6d42 [IRGen] Add flags to enable or disable generation of layout string value witnesses (#64819)
rdar://107477762
2023-04-07 13:45:52 -07:00
Xi Ge
0488c5a037 Merge pull request #64943 from nkcsgexi/block-list 2023-04-05 19:52:56 -07:00
Alex Lorenz
ce443011c0 Merge pull request #64924 from hyp/eng/cxx-interop-default-mode
[interop] support 'default' mode for '-cxx-interoperability-mode' option
2023-04-05 15:51:11 -07:00
Xi Ge
aa76845042 Merge branch 'main' into block-list 2023-04-05 12:21:40 -07:00
Xi Ge
2c2431e2da Frontend: add a frontend argument to pass down block list config file path 2023-04-05 12:20:49 -07:00
Steven Wu
09b8af86fb Virtualize swift compiler outputs (#63206)
Using a virutal output backend to capture all the outputs from
swift-frontend invocation. This allows redirecting and/or mirroring
compiler outputs to multiple location using different OutputBackend.

As an example usage for the virtual outputs, teach swift compiler to
check its output determinism by running the compiler invocation
twice and compare the hash of all its outputs.

Virtual output will be used to enable caching in the future.
2023-04-05 23:34:37 +08:00
Alex Lorenz
00181138fd [interop] support 'default' mode for '-cxx-interoperability-mode' option
Default corresponds to the Swift language version used to compile the input. Swift-5.9 is still supported for now, but will be removed shortly
2023-04-04 15:35:48 -07:00
Hamish Knight
af7134b884 Fully enable ExperimentalStringProcessing
Previously we would only enable by default when
`parseArgs` was called. However this wouldn't
enable it for clients such as LLDB, who provide
their own invocation. Switch the default to `true`
in the `LangOptions`, and remove some redundant
uses of `-enable-experimental-string-processing`.
The frontend flag remains, as it may be useful to
disable.

rdar://107419385
rdar://101765556
2023-03-31 18:10:39 +01:00
Alejandro Alonso
4a681160dc Merge pull request #64673 from Azoy/builtin-module-feature
[Frontend] Add BuiltinModule experimental feature
2023-03-29 23:12:40 -07:00
Nuri Amari
564621e330 Create feature flag for SE-0384 2023-03-29 10:25:22 -07:00
swift-ci
3be14e0a4a Merge pull request #64622 from kavon/bifurcate-moveonly-featureflag
Fix minimal stdlib builds with noncopyable types
2023-03-28 14:44:24 -07:00
Alejandro Alonso
c21899ee0f Add BuiltinModule experimental feature 2023-03-28 09:41:37 -07:00
Allan Shortlidge
7d1d7a35bb Frontend: Introduce the -unavailable-decl-optimization flag.
Part of rdar://106674022
2023-03-27 11:40:53 -07:00
Kavon Farvardin
6f98e9a2c6 trifurcate the MoveOnly feature
I want to reserve Feature::MoveOnly only for move-only types and other
things that are part of SE-390. Other prototyped features like
noimplicitcopy and some older names for consume were left behind
as guarded by this Feature. That's really not the right way to do it,
as people will expect that the feature is enabled all the time, which
would put those unofficial features into on-by-default. So this change
introduces two new Features to guard those unofficial features.
2023-03-24 15:43:35 -07:00
Rintaro Ishizaki
d8c8574e9b [Macros] Load '-load-plugin-library' plugins lazily
* Argument to '-load-plugin-library' now must have a filename that's
  '{libprefix}{modulename}.{sharedlibraryextension}'
* Load '-load-plugin-library' plugins are now lazily loaded in
  'CompilerPluginLoadRequest'
* Remove ASTContext.LoadedSymbols cache because they are cached by
  'ExternalMacroDefinitionRequest' anyway
* `-load-plugin-executable` format validation is now in
  'ParseSearchPathArgs'
2023-03-24 14:11:24 -07:00
Allan Shortlidge
a58ad6ba33 Frontend: Remove support for the -check-api-availability-only flag.
The functionality for this flag is no longer necessary because the emit module jobs for deprecated architectures no longer use an artificially low deployment target.

Resolves rdar://104758113
2023-03-23 23:02:13 -07:00
Rintaro Ishizaki
b2542a7ce9 [Macros] Small review changes
* New struct to store a pair of plugin search path and the server path
* typo
2023-03-17 19:15:06 -07:00
Rintaro Ishizaki
c4b3edd6df [Macros] Add swift-plugin-server executable
This executable is intended to be installed in the toolchain and act as
an executable compiler plugin just like other 'macro' plugins.

This plugin server has an optional method 'loadPluginLibrary' that
dynamically loads dylib plugins.
The compiler has a newly added option '-external-plugin-path'. This
option receives a pair of the plugin library search path (just like
'-plugin-path') and the corresponding "plugin server" path, separated
by '#'. i.e.

  -external-plugin-path
    <plugin library search path>#<plugin server executable path>

For exmaple, when there's a macro decl:

  @freestanding(expression)
  macro stringify<T>(T) -> (T, String) =
      #externalMacro(module: "BasicMacro", type: "StringifyMacro")

The compiler look for 'libBasicMacro.dylib' in '-plugin-path' paths,
if not found, it falls back to '-external-plugin-path' and tries to find
'libBasicMacro.dylib' in them. If it's found, the "plugin server" path
is launched just like an executable plugin, then 'loadPluginLibrary'
method is invoked via IPC, which 'dlopen' the library path in the plugin
server. At the actual macro expansion, the mangled name for
'BasicMacro.StringifyMacro' is used to resolve the macro  just like
dylib plugins in the compiler.

This is useful for
 * Isolating the plugin process, so the plugin crashes doesn't result
   the compiler crash
 * Being able to use library plugins linked with other `swift-syntax`
   versions

rdar://105104850
2023-03-16 14:00:45 -07:00
Ellie Shin
0fe0d6d221 Allow Swift as a package name
Update AccessScope::isChildOf
Add more tests for package access level
Resolves rdar://106728606
2023-03-14 17:17:14 -07:00
Puyan Lotfi
d55cfd26da Merge pull request #61606 from NuriAmari/fwd-declarations
Import Forward Declared Objective-C Interfaces and Protocols
2023-03-08 21:44:47 -08:00
Saleem Abdulrasool
09ade25b31 Merge pull request #64151 from compnerd/control
Driver: introduce additional Windows controls
2023-03-08 13:24:19 -08:00
Nuri Amari
86c5698780 Implement importing of forward declared objc protocols and interfaces
This modifies the ClangImporter to introduce an opaque placeholder
representation for forward declared Objective-C interfaces and
protocols when imported into Swift.

In the compiler, the new functionality is hidden behind a frontend
flag -enable-import-objc-forward-declarations, and is on by default
for language mode >6.

The feature is disabled entirely in LLDB expression evaluation / Swift
REPL, regardless of language version.
2023-03-07 16:00:16 -08:00
zoecarver
8c40e464ad [nfc][cxx-interop] Bump swift version swift-5.7 -> swift-5.9. 2023-03-07 10:23:20 -08:00
zoecarver
dcd83a807f [nfc][cxx-interop] Rename cxx-compatibility-mode -> cxx-interoperability-mode. 2023-03-07 10:23:19 -08:00
zoecarver
b64b52ae83 [cxx-interop] Add -cxx-compatibility-mode driver flag; deprecate -enable-experimental-cxx-interop. 2023-03-07 10:22:57 -08:00
Saleem Abdulrasool
73cafebaf5 Driver: introduce additional Windows controls
This adds the following four new options:
  - `-windows-sdk-root`
  - `-windows-sdk-version`
  - `-visualc-tools-root`
  - `-visualc-tools-version`

Together these options make one the master of Windows SDK selection for
the Swift compilation.  This is important as now that the injection is
no longer done by the user, we need to ensure that we have enough
control over the paths so that the synthesized overlay is going to map
the files to the proper location.
2023-03-06 13:29:31 -08:00
Alastair Houghton
44783e72c6 [Frontend] Add support for implicit import of _Backtracing
Once the API has gone through Swift Evolution, we will want to implicitly
import the _Backtracing module.  Add code to do that, but set it to off
by default for now.

rdar://105394140
2023-03-04 08:00:06 +00:00
Alexis Laferrière
cceafcf4ee [Frontend] Move the package name option from frontend to LangOptions 2023-03-03 11:42:59 -08:00
Mishal Shah
aced44a84b Merge pull request #63187 from apple/rebranch
Merge `rebranch` into `main` to support `stable/20221013` llvm-project branch
2023-03-03 11:01:34 -08:00
Doug Gregor
1b3fda7857 Merge pull request #64060 from DougGregor/enable-swift-syntax-formatter 2023-03-03 06:24:29 -08:00
Doug Gregor
53989ad72c [Diagnostics] Use the new swift-syntax formatter for -diagnostic-style swift.
We're going to move toward the new swift-syntax formatter. Use it for
the "swift" diagnostic style instead of the experimental formatter
written in C++.

There are some tests for the experimental formatter in C++ that test
precise formatting of diagnostics. I've disabled them in the same
places where the new swift-syntax formatter is enabled, for now. We
may choose to remove them entirely, because swift-syntax itself is
where the specific format is defined, and has those same kinds of
tests already.
2023-03-02 21:58:27 -08:00
Mishal Shah
e256b56545 Merge branch 'main' into rebranch 2023-03-02 18:25:09 -08:00
Andrew Trick
bffe0e7736 Merge pull request #64022 from atrick/ossa-complete-util
[NFC] Add SILGenCleanup::completeOSSLifetimes
2023-03-02 08:53:44 -08:00
Andrew Trick
2743b83b8e Added option: -enable-ossa-complete-lifetimes
Disabled by default during initial testing.
2023-03-01 21:41:46 -08:00
Ben Barham
59afba5bf9 Manually merge branch 'main' into rebranch 2023-03-01 14:13:50 -08:00
Artem Chikin
1600bee812 Merge pull request #63975 from artemcm/ClangModuleValidatePerSeshhhh
Add Swift compilation flags to enable Clang's validate-per-build-session module behavior
2023-03-01 08:40:37 -08:00
Artem Chikin
3ea5087e2f Add Swift compilation flags to enable Clang's validate-per-build-session module behavior
Add '-validate-clang-modules-once' and '-clang-build-session-file' corresponding to Clang's '-fmodules-validate-once-per-build-session' and '-fbuild-session-file='. Ensure they are propagated to module interface build sub-invocations.

We require these to be first-class Swift options in order to ensure they are propagated to both: ClangImporter and implicit interface build compiler sub-invocations.

Compiler portion of rdar://105982120
2023-02-28 13:19:05 -08:00