Commit Graph

738 Commits

Author SHA1 Message Date
Allan Shortlidge
e50b27f088 Merge pull request #78766 from tshortli/warnings
IRGen/Runtime: Suppress some warnings
2025-01-21 00:19:29 -08:00
Allan Shortlidge
47273273f5 IRGen: Remove unused function isStandardLibrary(). 2025-01-20 20:20:12 -08:00
Saleem Abdulrasool
370cbca889 IRGen: repair a small regression on Windows (#78689)
Correct the IRGen for the standard library. The thinko here assumed that the else case would be evaluated for the standard library build. We ended up incorrectly handling the well-known VWTs from the runtime when building the standard library.
2025-01-20 19:00:05 -08:00
Saleem Abdulrasool
ec70054c93 IRGen: further generalise runtime function generation
This adjusts the runtime function declaration handling to track the
owning module for the well known functions. This allows us to ensure
that we are able to properly identify if the symbol should be imported
or not when building the shared libraries. This will require a
subsequent tweak to allow for checking for static library linkage to
ensure that we do not mark the symbol as DLLImport when doing static
linking.
2025-01-15 13:54:34 -08:00
Allan Shortlidge
d0f63a0753 AST: Split Availability.h into multiple headers.
Put AvailabilityRange into its own header with very few dependencies so that it
can be included freely in other headers that need to use it as a complete type.

NFC.
2025-01-03 18:36:04 -08:00
Saleem Abdulrasool
c052d1b935 IRGen: simplify the stdlib special casing for Windows
Remove `IRGenModule::useDllStorage()` as there is a standalone version
that is available and the necessary information is public from the
`IRGenModule` type. Additionally, avoid the wrapped `isStandardLibrary`
preferring to use the same method off of the public accessors. This
works towards removing some of the standard library special casing so
that it is possible to support both static and dynamic standard
libraries on Windows.
2024-12-16 14:46:38 -08:00
Saleem Abdulrasool
8473d40f50 lib: use CXX_MODULE_NAME constant for module identifier (NFC)
Use the well known specifier for explicit references to the `Cxx` module
rather than re-spelling the name at the various sites.
2024-12-09 13:34:06 -08:00
Ben Barham
746517c9f2 Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `test/IRGen/has_symbol.swift` test updates in rebranch. The new test
    will fail, will fix in the next commit.
2024-10-24 14:20:17 -07:00
Artem Chikin
d0ff56b345 Merge pull request #70564 from artemcm/ExplicitBuildClangTargetIRGen
[Explicit Module Builds] Initialize `ClangImporter`'s `CodeGenerator` using Swift compilation Target Triple.
2024-10-24 09:45:51 -07:00
Joe Groff
8242110bbe Merge pull request #76831 from jckarter/builtin-vector
Builtin.FixedArray
2024-10-23 05:20:21 -10:00
Joe Groff
a184782a38 Introduce a Builtin.FixedArray type.
`Builtin.FixedArray<let N: Int, T: ~Copyable & ~Escapable>` has the layout of `N` elements of type `T` laid out
sequentially in memory (with the tail padding of every element occupied by the array). This provides a primitive
on which the standard library `Vector` type can be built.
2024-10-22 16:21:45 -07:00
Artem Chikin
0fbbba5154 [Explicit Module Builds] Initialize ClangImporter's 'CodeGenerator' using Swift compilation Target Triple.
As per #65930, the Clang importer's Clang instance may be configured with a different (higher) OS version than the compilation target itself in order to be able to load pre-compiled Clang modules that are aligned with the broader SDK, and match the SDK deployment target against which Swift modules are also built. Code-generation, however, must use the actual compilation target triple. This matches how Swift itself loads Swift module dependencies as well: dependency '.swiftinterface' files are type-checked against the availability epoch and code-generated against the actual compilation triple.

Resolves rdar://113712186
2024-10-21 14:12:23 -07:00
swift-ci
ffb7eef5ab Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 05:15:25 -07:00
Arnold Schwaighofer
8ebb3ec473 IRGen: Add the ability to mark certain generic entry points in back traces
Mark generic function calls with concrete parameters, generic v-table calls and
generic witness table calls where self is generic.
2024-10-14 14:06:10 -07:00
Ben Barham
c15bc19946 Merge remote-tracking branch 'origin/main' into main-to-rebranch
Conflicts:
  - `lib/Serialization/ModuleFileSharedCore.cpp` new headers on main
2024-09-26 16:01:56 -07:00
Erik Eckstein
401a602b23 IRGen: support emitting specialized witness tables 2024-09-25 19:32:14 +02:00
swift-ci
658a00ce26 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-20 14:14:24 -07:00
Kuba Mracek
6b9a3051e3 [embedded] Introduce class-bound existentials into Embedded Swift
Motivated by need for protocol-based dynamic dispatch, which hasn't been possible in Embedded Swift due to a full ban on existentials. This lifts that restriction but only for class-bound existentials: Class-bound existentials are already (even in desktop Swift) much more lightweight than full existentials, as they don't need type metadata, their containers are typically 2 words only (reference + wtable pointer), don't incur copies (only retains+releases).

Included in this PR:
[x] Non-generic class-bound existentials, executable tests for those.
[x] Extension methods on protocols and using those from a class-bound existential.
[x] RuntimeEffects now differentiate between Existential and ExistentialClassBound.
[x] PerformanceDiagnostics don't flag ExistentialClassBound in Embedded Swift.
[x] WTables are generated in IRGen when needed.

Left for follow-up PRs:
[ ] Generic classes support
2024-09-19 07:49:50 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Allan Shortlidge
02dbb96b94 AST: Rename AvailabilityContext to AvailabilityRange.
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
swift-ci
da55e84c74 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 15:35:33 -07:00
Alejandro Alonso
f2f82a7de6 Add initRawStructMetadata2 for safety 2024-09-04 15:13:51 -07:00
Ben Barham
467e528200 Merge remote-tracking branch 'origin/main' into manual-rebranch-merge
Conflicts:
  - `lib/Serialization/ModuleFormat.h` bumped version to account for
    differences between main and rebranch.
2024-08-09 15:22:39 -07:00
Egor Zhdan
bfe72b4be9 Merge pull request #75589 from swiftlang/egorzhdan/linux-libcxx-interop
[cxx-interop] Allow compiling with libc++ on Linux
2024-08-09 13:42:29 +01:00
Egor Zhdan
059f0f97d1 [cxx-interop] Allow compiling with libc++ on Linux
This makes sure that Swift respects `-Xcc -stdlib=libc++` flags.

Clang already has existing logic to discover the system-wide libc++ installation on Linux. We rely on that logic here.

Importing a Swift module that was built with a different C++ stdlib is not supported and emits an error.

The Cxx module can be imported when compiling with any C++ stdlib. The synthesized conformances, e.g. to CxxRandomAccessCollection also work. However, CxxStdlib currently cannot be imported when compiling with libc++, since on Linux it refers to symbols from libstdc++ which have different mangled names in libc++.

rdar://118357548 / https://github.com/swiftlang/swift/issues/69825
2024-08-08 16:24:58 +01:00
swift-ci
f1ea924a51 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-24 10:14:18 -07:00
Allan Shortlidge
bb8a837dcf IRGen: Honor -target-variant flag for zippered macCatalyst binaries. 2024-07-23 17:00:10 -07:00
swift-ci
0be42b6b18 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-11 06:14:58 -07:00
Slava Pestov
403bb98451 AST: Optimize collectLinkLibraries()
SourceFile::collectLinkLibraries() did not depend on the source file,
so let's move this logic up into ModuleDecl::collectLinkLibraries().
2024-07-10 23:06:22 -04:00
swift-ci
f2e68e5db1 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 11:36:11 -07:00
Ben Barham
d72f5b12c4 Update StringRef::equals references to operator==
`equals` has been deprecated upstream, use `operator==` instead.
2024-06-27 19:14:06 -07:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -07:00
Tim Kientzle
598e5104ef Merge pull request #74184 from tbkka/tbkka-assertions2
Add `#include "swift/Basic/Assertions.h"` to a lot of source files
2024-06-20 12:13:28 -07:00
swift-ci
e4e79345ad Merge remote-tracking branch 'origin/main' into rebranch 2024-06-19 21:14:11 -07:00
Kuba Mracek
62d7167c3f [embedded] Enable read-only static array promotion in embedded mode 2024-06-19 09:16:04 -07:00
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
swift-ci
b861f5c6f3 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-14 07:15:26 -07:00
Konrad `ktoso` Malawski
2ec717b115 [Concurrency] TaskExecutor ownership fixes (#74000) 2024-06-14 22:56:33 +09:00
swift-ci
5e95443f0e Merge remote-tracking branch 'origin/main' into rebranch 2024-06-13 09:34:17 -07:00
Adrian Prantl
bba8b921ab Finalize Swift debug info before running Clang codegen, because it may delete
the llvm module.

rdar://128309024
2024-06-12 10:13:50 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
swift-ci
aed40bd421 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 19:34:38 -07:00
artemcm
d70863501e [Dependency Scanning] Collect and report each module dependency's Link Libraries 2024-06-05 10:59:41 -07:00
swift-ci
66a4c36346 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-03 03:36:17 -07:00
Kuba Mracek
399dbc97d5 [embedded] In -emit-empty-object-file mode, don't emit autolink entries 2024-06-01 10:20:18 -07:00
swift-ci
50ff2bfca4 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-22 10:34:59 -07:00
Erik Eckstein
1a32cfe426 IRGen: disable feature availability checking for embedded swift.
In embedded swift features are available independent of deployment and runtime targets because the runtime library is always statically linked to the program.
2024-05-21 13:31:36 +02:00
swift-ci
5b6eadf416 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-12 13:37:42 -07:00
Erik Eckstein
ce33d47a4c stdlib: add the swift_clearSensitive runtime function 2024-04-09 12:01:10 +02:00
Ben Barham
17b34312df [IRGen] Start cleaning up typed pointers
Typed pointers are slowly being removed. There's a lot more cleanup to
do here, since really all `IRGenModule::.*PtrTy` should just be `PtrTy`,
but this at least gets us compiling for now.
2024-04-08 08:58:59 -07:00