Commit Graph

1679 Commits

Author SHA1 Message Date
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
QuietMisdreavus
164e93e0a7 Merge pull request #63726 from apple/QuietMisdreavus/skip-proto-impls
[SymbolGraphGen] add new flag to skip "protocol implementation" symbols

rdar://59899968
2023-02-28 10:50:01 -07:00
Arnold Schwaighofer
1dfc30eb1f Merge remote-tracking branch 'origin/main' into rebranch 2023-02-27 09:18:56 -08:00
Arnold Schwaighofer
8a7b8dc39c IRGen: Put type descriptors in their own section to collocated them
rdar://104697150
2023-02-25 07:51:30 -08:00
swift-ci
76b7966ccb Merge remote-tracking branch 'origin/main' into rebranch 2023-02-20 22:16:03 -08:00
Alejandro Alonso
10f85db170 Merge pull request #63734 from Azoy/builtin-flag
[Frontend] Add option to explicitly import Builtin
2023-02-20 22:08:02 -08:00
swift-ci
2f942098d5 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-20 15:33:54 -08:00
Doug Gregor
165827ce9d Use -strict-concurrency=minimal as the default for Swift 5.x mode.
Emulate the behavior of Swift 5.5/5.6 by default, using
`-strict-concurrency=minimal`.
2023-02-20 11:14:46 -08:00
Alejandro Alonso
023c40c809 Add option to explicitly import Builtin 2023-02-16 15:23:45 -08:00
Victoria Mitchell
4ec3e5291f add new flag to skip "protocol implementation" symbols
rdar://59899968
2023-02-16 14:00:04 -07:00
swift-ci
5acf1c372e Merge remote-tracking branch 'origin/main' into rebranch 2023-02-16 12:54:58 -08:00
Rintaro Ishizaki
c82e17acb7 Merge pull request #63695 from rintaro/options-load-plugin-executable
[Option] Add compiler option to specify executable plugins
2023-02-16 12:35:35 -08:00
swift-ci
3d54aef31f Merge remote-tracking branch 'origin/main' into rebranch 2023-02-16 07:14:44 -08:00
Nate Chandler
1246a152a4 [Frontend] Relaxed flag combination check.
Previously, combining `-enable-lexical-lifetimes=false` with
`-enable-experimental-move-only` resulted in an error.  But this is a
valid combination: the former sets the `LexicalLifetimes` option to
`DiagnosticMarkersOnly`, which is what `-enable-experimental-move-only`
relies on.
2023-02-15 16:13:47 -08:00
Rintaro Ishizaki
bf0a62f3ce [Option] Add compiler option to specify executable plugins
Add a compiler option `-load-plugin-executable <path>#<module names>`.
Where '<path>' is a path to a plugin executable, '<module-name>' is a
comma-separated module names the plugin provides.

Nothing is using it at this point. Actual plugin infratructure are
introduced in follow-up commits
2023-02-15 14:43:21 -08:00
swift-ci
e1cd7779f7 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-10 00:35:26 -08:00
Doug Gregor
4705183149 [Macros] Add plugin search paths to load plugin modules by name.
Introduce `-plugin-path <path>` to add a search path where we will look
for compiler plugins. When resolving an external macro definition, look
for libraries in these search paths whose names match the module name
of the macro.

Implements rdar://105095761.
2023-02-09 13:47:26 -08:00
swift-ci
8e7eae199e Merge remote-tracking branch 'origin/main' into rebranch 2023-02-08 07:33:02 -08:00
Artem Chikin
c1599fede4 Add -swift-module-file frontend flag for explicit Swift module dependencies 2023-02-07 11:29:09 -07:00
swift-ci
d4f981232a Merge remote-tracking branch 'origin/main' into rebranch 2023-02-03 15:35:20 -08:00
Ellie Shin
258b13b05d Merge pull request #63355 from apple/es-export-pr
Add access level and scope checks to package types
2023-02-03 15:20:29 -08:00
Ellie Shin
be20333a87 Add access level and scope checks to package types
Resolves rdar://104617227
2023-02-02 16:51:17 -08:00
swift-ci
409f9c7f40 Merge remote-tracking branch 'origin/main' into rebranch 2023-02-01 14:34:59 -08:00
Ben Barham
8c7f331ba7 Merge pull request #63339 from bnbarham/wd-hack
[Frontend] Split -working-directory<path>
2023-02-01 14:16:47 -08:00
Ben Barham
b5caa97b6b [Frontend] Split -working-directory<path>
Clang no longer supports `-working-directory<path>`. Split this argument
into `-working-directory <path>` so that clients passing the old
argument still work.
2023-01-31 16:17:11 -08:00
swift-ci
ef62fdf232 Merge remote-tracking branch 'origin/main' into rebranch 2023-01-31 11:53:53 -08:00