Commit Graph

2117 Commits

Author SHA1 Message Date
Ben Barham
9779c18da3 Rename startswith to starts_with
LLVM is presumably moving towards `std::string_view` -
`StringRef::startswith` is deprecated on tip. `SmallString::startswith`
was just renamed there (maybe with some small deprecation inbetween, but
if so, we've missed it).

The `SmallString::startswith` references were moved to
`.str().starts_with()`, rather than adding the `starts_with` on
`stable/20230725` as we only had a few of them. Open to switching that
over if anyone feels strongly though.
2024-03-13 22:25:47 -07:00
Steven Wu
495a17743a Merge pull request #72168 from cachemeifyoucan/eng/PR-124222904
[Caching] Normalize DebugInfo flags
2024-03-13 13:13:32 -07:00
Ellie Shin
56d337d322 Merge pull request #72249 from apple/es/pkg-cmo 2024-03-13 09:26:35 -07:00
Arnold Schwaighofer
315a763c28 Merge pull request #72218 from aschwaighofer/fragile_resilient_protocols
IRGen: Add code to support building fragile resilient protocol witnesses
2024-03-13 08:40:44 -07:00
Ellie Shin
a3250e426d Support Package CMO
* Add a new flag -experimental-package-cmo that requires -experimental-allow-non-resilient-access.
* Support serializing package decls for CMO in package if enabled.
* Only applies to default mode CMO.
* Unlike the existing CMO, package CMO can be built with -enable-library-evolution as package
modules are required to be built together in the same project.
* Create hasPublicOrPackageVisibility to opt in for package decls; needed for CMO, SILVerifier,
and other call sites that verify or determine codegen.

Resolves rdar://121976014
2024-03-12 15:00:24 -07:00
Steven Wu
177bbe64d4 Merge pull request #71118 from cachemeifyoucan/eng/PR-119275464
[Caching] Create clang importer from cc1 args directly
2024-03-11 13:50:34 -07:00
Steven Wu
d38caf15cf [Caching] Normalize DebugInfo flags in DWARF
Do not encode cache invariant command-line flags in DWARF since those
flag should not affect code generation or diagnostics. This avoids
generating conflicting cache entry when caching is enabled, and will
make normal incremental builds more likely to hit fast skip codegen
path.

rdar://124222904
2024-03-11 10:37:31 -07:00
Arnold Schwaighofer
9639e007d8 Teach TBD that in fragile resilient protocol mode the protocol table is visible 2024-03-11 09:49:38 -07:00
Arnold Schwaighofer
ea70aea43c IRGen: Add code to support building fragile resilient protocol witnesses
We don't currently support building resilient relative protocol witness tables.
One might want to build with relative witness tables but not need
resilient protocols. Allow for that scenario.

Add a test configuration to test library-evolution + fragile resilient
protocols + relative protocol witness tables.
2024-03-10 09:14:08 -07:00
Slava Pestov
123045f825 Merge pull request #71780 from slavapestov/remove-non-experimental-assoc-type-inference
Remove old associated type inference implementation
2024-03-07 22:14:06 -05:00
Steven Wu
cb17ea8e66 [ScanDependency] Add -experimental-clang-importer-direct-cc1-scan
Add an experimental option to tell dependency scanner to report clang
cc1 args should be used to construct clang importer in all constructed
swift-frontend tasks.
2024-03-07 14:40:00 -08:00
Steven Wu
cdeef58e0f [Caching] Create clang importer from cc1 args directly
When caching build is enabled, teach dependency scanner to report
command-lines with `-direct-clang-cc1-module-build` so the later
compilation can instantiate clang importer with cc1 args directly. This
avoids running clang driver code, which might involve file system
lookups, which are the file deps that are not captured and might result
in different compilation mode.

rdar://119275464
2024-03-07 14:40:00 -08:00
Slava Pestov
af8c8f1671 Sema: Remove non-experimental associated type inference 2024-03-07 17:30:17 -05:00
Andrew Trick
093aed967c Enable lifetime dependence diagnostics for Nonescapable types.
Adds -Xfrontend -disable-lifetime-dependence-diagnostics.

Removes -Xllvm -enable-lifetime-dependence-insertion

Removes -Xllvm -enable-lifetime-dependence-diagnostics
2024-03-07 13:40:25 -08:00
Becca Royal-Gordon
fd9ae4c8ac Merge pull request #72023 from beccadax/lazy-objc-workaround
Add workaround flag for lazy import-as-member
2024-03-05 16:12:32 -08:00
Becca Royal-Gordon
54fd4b01b6 Add workaround flag for lazy import-as-member
In rdar://123649082, a project failed to build because of the lazy import-as-member loading changes in #71320. That project was configured in a way that broke modularization and the correct solution is to fix it, but out of an abundance of caution, add a `-disable-named-lazy-import-as-member-loading` frontend flag in case a project needs to temporarily restore the old behavior.

As a bonus, this lets us write a test to verify that lazy import-as-member loading has positive performance impact.
2024-03-05 11:09:17 -08:00
Steven Wu
3e903688a2 [ScanDependency] Do not use public/private swiftinterface in the same package
When scanning finds a dependency in the same package, do not load
public/private swiftinterface since they do not have the package level
decl to compile the current module. Always prefer package module (if
enabled), or use binary module, unless it is building a public/private
swiftinterface file in which case the interface file is preferred.

This also does some clean up to sync up the code path between implicit
and explicit module finding path.

rdar://122356964
2024-02-28 17:34:03 -08:00
Doug Gregor
0c9c734f7e Merge pull request #71722 from DougGregor/diagnostic-style-swift-default 2024-02-24 14:42:38 -10:00
Alastair Houghton
786e178113 [Frontend] Use the swift_static directory when appropriate.
We should be using `/usr/lib/swift_static` and not `/usr/lib/swift`
when we're using the static resource directory.

rdar://123506588
2024-02-23 16:01:56 +00:00
Mishal Shah
cb96ec2893 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-22 09:44:44 -08:00
Ben Barham
5637284e48 Merge pull request #71368 from bnbarham/std-optional-all-the-things
Migrate llvm::Optional to std::optional
2024-02-21 16:54:00 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Alex Lorenz
6312fc05cc [interop] adopt a swift-6 interoperability mode for new features in the next release 2024-02-21 09:27:45 -08:00
Kuba (Brecka) Mracek
1c03d5bd13 Merge pull request #71729 from kubamracek/embedded-dwarf-types
[embedded] Promote -g to -gdwarf-types by default on embedded Swift
2024-02-21 00:14:48 -08:00
Mishal Shah
b488702cc9 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 21:04:47 -08:00
Allan Shortlidge
72da8f4e9c Serialization: Skip invalid decls during module serialization.
When `-enable-lazy-typecheck` is specified, serialization may be expected to
run on an AST containing invalid declarations since type checking may happen
on-demand, during serialization, in this mode. If the declarations that are
invalid are not skipped, then the compiler is likely to crash when attempting
to serialize them. Now, invalid declarations are skipped and an error is
emitted at the end of serialization to note that serialization failed.

Additionally, a new `-Rmodule-serialization` flag can be specified to request
more detailed information about module serialization failures. This would be
useful in a situation where lazy typechecking does not produce any diagnostic
for some reason, but module serialization fails and more information is
therefore required to debug.

Resolves rdar://123260476
2024-02-19 20:52:17 -08:00
Mishal Shah
af112c1591 Update the Swift version to 6.0 from 5.11 2024-02-19 17:47:16 -08:00
Kuba Mracek
1f165228e6 [embedded] Promote -g to -gdwarf-types by default on embedded Swift 2024-02-19 11:41:05 -08:00
Doug Gregor
8ed35de4e0 Switch to the 'Swift' diagnostic style as the default 2024-02-19 02:48:23 -10:00
Ellie Shin
3a80ed705b Merge pull request #71663 from apple/es-bypass-opt
Move in-package resilience bypassing logic to a resilience check with accessing module
2024-02-16 14:12:35 -08:00
Erik Eckstein
06ce47fa09 embedded: enable OSSA modules in embedded swift
OSSA modules are required for deinit de-virtualization

rdar://122651706
2024-02-16 08:49:28 +01:00
Ellie Shin
8d733cbe4b Rename package-bypass-resilience-optimization -> experimental-package-bypass-resilience 2024-02-15 13:14:53 -08:00
Ellie Shin
4588cc2261 Support bypassing resilience checks for package decls at use site in a package.
By default package decls are treated as resilient, similar to public (non-frozen).
This PR adds support to allow direct access to package decls at use site if opted-in.
Requires the loaded module to be a binary module in the same package.

Resolves rdar://121626315
2024-02-13 19:09:31 -08:00
Steven Wu
9607e9dec1 Merge pull request #71497 from cachemeifyoucan/eng/PR-122423965
[Caching] Use subInvocation to verify interface
2024-02-13 09:18:40 -08:00
Steven Wu
3986937e03 [Caching][NFC] Restructure CASOption in swift. NFC
Clean up how CASOptions are kept and passed inside swift to make the
code more readable. Also avoid a copy of CAS configuration in
ClangImporter.
2024-02-11 14:08:09 -08:00
Kavon Farvardin
a396fcc43a LangOptions: tie NoncopyableGenerics to build
There were a handful of different places trying to enable the
feature-flag when the stdlib has been built with the feature enabled.
This change cleans that up and unifies it in one spot for all sub-tools
like sil-opt and sil-func-extractor to pick-up.
2024-02-07 15:48:31 -08:00
Kavon Farvardin
ee12fd6655 NCGenerics: reenable round-trip for mangling 2024-02-06 08:15:26 -08:00
nate-chandler
f98b211f18 Merge pull request #71403 from nate-chandler/delete-flag
[Frontend] Removed enable-lexical-borrow-scopes flag.
2024-02-06 07:00:25 -08:00
Nate Chandler
ddccaa7d9c [Frontend] Removed lexical-borrow-scope flag.
Adding `move_value [lexical]` and `begin_borrow [lexical]` should happen
all the time at this point.  Remove the ability to omit these
instructions and update the corresponding tests.
2024-02-05 17:34:10 -08:00
Allan Shortlidge
67661ccf93 Frontend: Ignore lazy typechecking flags when emitting non-resilient modules.
The `-experimental-lazy-typecheck` and `-experimental-skip-non-exportable-decls`
flags are not safe to use when emitting a non-resilient module because the
clients of non-resilient modules expect to have access to all the members of a
type in order to e.g. compute the size the type. The
`-experimental-skip-non-exportable-decls` flag skips serialization of
non-public members and would therefore cause mis-compilation. The
`-experimental-lazy-typecheck` is theoretically safe for non-resilient modules
but more requestification work is needed before it can be used successfully.

Resolves rdar://122272758
2024-02-04 09:10:46 -08:00
Slava Pestov
8db0af48bd Merge pull request #71352 from slavapestov/remove-redundant-requirements
Remove -warn-redundant-requirements flag
2024-02-03 08:28:02 -05:00
Alastair Houghton
4c7822cdac Merge pull request #71213 from al45tair/eng/PR-121522431
[Frontend][AST][IRGen] Improve availability support.
2024-02-02 22:30:19 +00:00
Slava Pestov
dcca5ced0f RequirementMachine: Remove -warn-redundant-requirements flag 2024-02-02 14:57:19 -05:00
Alastair Houghton
c226bf3c3c [AST][IRGen] Add -min-runtime-version option and IRGen support code.
Add a `-min-runtime-version` option that can be used to avoid problems
when building on Linux and Windows where because the runtime isn't
part of the OS, availability doesn't solve the problem of trying to
build the compiler against an older runtime.

Also add functions to IRGen to make it easy to test feature
availability using both the runtime version and the existing Darwin
availability support.

rdar://121522431
2024-02-02 16:17:08 +00:00
Slava Pestov
39411d31e9 Sema: Fix -debug-inverse-requirements flag 2024-02-01 17:17:43 -05:00
Meghana Gupta
968f69cf66 Add -enable-experimental-lifetime-dependence-inference option
Until stdlib can be built with noncopyable generics, stdlib types
can appear as ~Escapable and ~Copyable, leading to invalid inference.

Use a flag to test implicit lifetime dependence
2024-01-31 00:01:32 -08:00
Arnold Schwaighofer
701549fe6e Merge pull request #71215 from aschwaighofer/large_loadable_reg2mem
Large loadable types peepholes and address assignment
2024-01-30 10:41:20 -08:00
Slava Pestov
f79aa8d556 Turn on -enable-experimental-associated-type-inference by default 2024-01-29 23:38:45 -05:00
Arnold Schwaighofer
5e2144bdb8 Large loadable types peepholes and address assignment
Contract some load store patterns and assign addresses to (non-address)
SIL SSA values.

rdar://115571407
2024-01-29 17:10:46 -08:00