Commit Graph

6196 Commits

Author SHA1 Message Date
Alastair Houghton
a25cd37750 Add support to the compiler for musl and the LINUX_STATIC SDK.
This is really just about setting appropriate defaults (such as
making sure that the static Linux triple causes us to use lld).

rdar://123506306
2024-05-07 16:48:52 +01:00
swift-ci
a0dc01e3e5 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-06 05:33:47 -07:00
Egor Zhdan
c88e65b604 Merge pull request #73337 from apple/egorzhdan/unnamed-subscript-param
[cxx-interop] Do not crash when calling a subscript with unnamed parameter
2024-05-06 14:25:00 +02:00
swift-ci
692ca26160 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-04 10:34:18 -07:00
nate-chandler
bcd08c0c9a Merge pull request #73235 from nate-chandler/bitwise-copyable/enable
[BitwiseCopyable] Promote to feature.
2024-05-04 10:16:40 -07:00
swift-ci
0dc116de06 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-03 09:15:44 -07:00
Steven Wu
7091876e64 [ScanDependencies] Fix assertion failure when failed to scan header
Fix an assertion failure when bridging header dependency scanning
failed.

rdar://127459045
2024-05-02 15:33:09 -07:00
Becca Royal-Gordon
07b2b9a01f [NFC] Add @objc to imported ObjC categories
This contains the category name, if there is one.
2024-05-01 12:18:19 -07:00
Becca Royal-Gordon
c3225b066e [NFC] Merge two category name accessors 2024-05-01 12:18:19 -07:00
Egor Zhdan
ae27e884d5 [cxx-interop] Do not crash when calling a subscript with unnamed parameter
This fixes a crash in SILGen when calling a C++ subscript that has an unnamed parameter from Swift.

The parameters from a C++ `operator[]` get carried over to the synthesized Swift subscript. If the Swift parameter has no name, there is no way to refer to it in SIL. However, the synthesized subscript accessor needs to pass this parameter to C++.

This change makes sure that we give a name to the Swift parameter if there isn't already a name on the C++ side.

rdar://83163841
2024-05-01 12:30:18 +01:00
Yeoul Na
ffa8bd514c [ClangImporter] Fix up for CountAttributedType and TypeCoupledDeclRefInfo handlers
CountAttributedType and TypeCoupledDeclRefInfo are new Clang type
and type metadata created for types with the 'counted_by' attribute
that shouldn't be accessible from Swift right now. Hence, marking
them unreachable.
2024-04-30 16:10:52 -07:00
Ben Barham
445ee1ec14 Manually merge rebranch into main
Conflicts:
  - `lib/ClangImporter/ImportDecl.cpp` as `isPure` is now
    `isPureVirtual`
2024-04-25 13:48:57 -07:00
Nate Chandler
b1fbe4ea91 [BitwiseCopyable] Remove underscore. 2024-04-25 11:44:15 -07:00
Nate Chandler
ed5c7ef7ae [BitwiseCopyable] Promote to feature.
SE-0426 was accepted.
2024-04-24 15:52:20 -07:00
Egor Zhdan
b330376a43 [cxx-interop] Pull changes from swift-6 compat mode into swift-5.9
This gives projects using C++ interop compat mode 5.9 access to the new features such as virtual methods and move-only types.

rdar://126485814
2024-04-24 11:53:31 +01:00
swift-ci
09ef2055c3 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-23 16:53:38 -07:00
Egor Zhdan
70c3e432f6 Merge pull request #73055 from apple/egorzhdan/ncg-unsafepointer
[cxx-interop] Import `NonCopyable*` as `OpaquePointer` if noncopyable generics are disabled
2024-04-24 00:45:25 +01:00
Egor Zhdan
6140ba1079 [cxx-interop] Do not try to use UnsafePointer<T> for non-copyable T when adding base member accessors 2024-04-23 18:47:55 +01:00
Egor Zhdan
78eee32467 [cxx-interop] Import NonCopyable* as OpaquePointer if noncopyable generics are disabled
C++ pointer type `T*` is generally imported as `Unsafe(Mutable)Pointer<T>`. However, if `T` is non-copyable in Swift (e.g. it has a deleted C++ copy constructor), using `UnsafePointer<T>` type requires noncopyable generics to be enabled.

This was causing assertion failures when building SwiftCompilerSources in https://github.com/apple/swift/pull/72912.
2024-04-23 18:47:55 +01:00
swift-ci
e0bd65994e Merge remote-tracking branch 'origin/main' into rebranch 2024-04-19 10:16:17 -07:00
Anthony Latsis
4af5140d8b Merge pull request #70579 from AnthonyLatsis/super-sema
Move unsupported `super` use diagnosis from Parse to Sema
2024-04-19 20:07:12 +03:00
Anthony Latsis
1d3a5860e2 [NFC] ParamDecl: Extract write of type-checked default expr into its own method 2024-04-19 16:57:05 +03:00
swift-ci
fa8b682652 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-18 15:19:35 -07:00
Egor Zhdan
2bc41997b5 [cxx-interop] Do not try to import std::chrono::tzdb, part 2
`tzdb` is declared inside of `namespace chrono`, so the check needs to be adjusted.

rdar://126486849 / https://github.com/apple/swift/issues/73037
2024-04-18 15:29:41 +01:00
swift-ci
0cf01c3fbe Merge remote-tracking branch 'origin/main' into rebranch 2024-04-17 15:46:01 -07:00
Nate Chandler
c43f87101f Merge branch 'main' into rebranch
Conflicts:
      lib/Basic/Platform.cpp

```
diff --git a/lib/Basic/Platform.cpp b/lib/Basic/Platform.cpp
index 240edfa144a..1797c87635f 100644
--- a/lib/Basic/Platform.cpp
+++ b/lib/Basic/Platform.cpp
@@ -200,10 +200,7 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
   case llvm::Triple::CUDA:
   case llvm::Triple::DragonFly:
   case llvm::Triple::DriverKit:
-<<<<<<< HEAD
   case llvm::Triple::ELFIAMCU:
-=======
->>>>>>> main
   case llvm::Triple::Emscripten:
   case llvm::Triple::Fuchsia:
   case llvm::Triple::HermitCore:
```
2024-04-17 13:32:48 -07:00
Egor Zhdan
c90cb4bc38 [cxx-interop] Do not try to import std::tzdb
In libstdc++13 on Ubuntu 23.10 the type `std::tzdb` is non-copyable but does not explicitly delete its copy constructor. It instead triggers template instantiation errors when trying to use the copy constructor. This is problematic for Swift, since we try to instantiate copy constructors for most C++ types we import.

This disables the import of `std::tzdb` to unblock nightly toolchains for Ubuntu 23.10 until we come up with a better solution.

rdar://126486849 / https://github.com/apple/swift/issues/73037
2024-04-17 19:49:52 +01:00
Steven Wu
e654e371de [BridgingHeader] Implicit import bridging header from CAS module
The binary module built from a CAS build will have the embeded bridging
header info with 0 modTime. Allow a regular build to import such a
module with the same behavior as if the module is built from a regular
build.

rdar://126221616
2024-04-15 14:47:56 -07:00
Steven Wu
7a68d364f4 [Caching] Embed bridging header in binary module correctly when caching
When caching is enabled with include-tree, the bridging header PCH is
created from the include tree directly. Setup the rewriter correctly
when embedding the bridging header into swift binary module.

rdar://125719747
2024-04-15 14:46:38 -07:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
swift-ci
d2bc4a29e3 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-15 08:16:27 -07:00
swift-ci
5b6eadf416 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-12 13:37:42 -07:00
Ben Langmuir
d178172b5c [Caching] Adopt -finclude-tree-preserve-pch-path to fix -gmodules with
This fixes -gmodules when caching by adopting the new clang -cc1 option
-finclude-tree-preserve-pch-path. -gmodules is required to make
debugging work when examining types that come from clang modules or
bridging headers, but was previously being disabled by clang's caching
support.

rdar://126370706
2024-04-12 13:20:30 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Erik Eckstein
3097cceba0 clang importer: import __attribute__((swift_attr("sensitive"))) on C structs as @sensitive attributes 2024-04-09 12:01:10 +02:00
Ben Barham
a4405405a1 [ClangImporter] Rename SwiftVersionedAttr to SwiftVersionedAdditionAttr
Renamed in our LLVM fork 628ee3b842b1fcc93afdebc646220e8ae6302ed6.
2024-04-08 08:58:59 -07:00
Ben Barham
a4367131a7 [ClangImporter] Update moved isSimpleTypeSpecifier reference
Moved from `Sema` to `Token` in LLVM
a8279a8bc541b6027087dd497daa63b6602b7f4b.
2024-04-08 08:58:59 -07:00
Ben Barham
65a2f093c8 [ClangImporter] Rename CXXMethodDecl::isPure to isVirtualPure
Renamed in LLVM e90e43fb9cd1d305f7196cd526aa503374e0f616.
2024-04-08 08:58:59 -07:00
Ben Barham
247d81338c [ClangImporter] Copy APSInt rather than taking its address
142f270c279f2576e4618fc0d1121181c7531fdf fixed a memory leak involving
`APSInt`. It is now returned by value in `getInitVal`.
2024-04-08 08:58:59 -07:00
Ben Barham
5b61aab224 [ClangImporter] Remove ClassScopeFunctionSpecializationDecl
Removed in LLVM 3a3b84b180278207731451dfac24f47d02b50e84.
2024-04-08 08:58:58 -07:00
Ben Barham
0c0c4ea7c3 [ClangImporter] Use new CXXThisExpr::Create function
The constructor takes a new arg which `Create` now handles. Use it
instead.
2024-04-08 08:58:58 -07:00
Ben Barham
a30de11b89 [ClangImporter] Add missing include for llvm::size
Presumably this was previously transitively included, who knows from
where.
2024-04-08 08:58:58 -07:00
Ben Barham
7d620bf750 [ClangImporter] Add empty visit implementation for new types
Two new unhandled types: `PackIndexingType` and `CountAttributedType`.
2024-04-08 08:58:58 -07:00
Ben Barham
a9077d7129 FileEntry to FileEntryRef updates 2024-04-08 08:58:58 -07:00
Ben Barham
0f52071c22 Fix up various references to renamed/moved enums
A bunch of enums were moved to enum classes and slightly renamed. Fix up
their references.
2024-04-08 08:58:58 -07:00
Ben Barham
cacfd3e3ae Rename llvm::support::endianness to llvm::endianness
LLVM is gearing up to move to `std::endianness` and as part of that has
moved `llvm::support::endianness` to `llvm::endianness`
(bbdbcd83e6702f314d147a680247058a899ba261). Rename our uses.
2024-04-08 08:58:58 -07:00
Artem Chikin
78852338de Revert "On 'canImport' of Clang submodules of modules with an umbrella header, attempt to infer the submodule" 2024-04-05 11:25:47 -07:00
Saleem Abdulrasool
fc5da5342c Merge pull request #72603 from compnerd/target-cpu
ClangImporter: handle `-target-cpu` for x86 targets
2024-04-04 07:00:34 +09:00
Egor Zhdan
a0c1027b6d Merge pull request #72766 from apple/egorzhdan/bump-std-default
[cxx-interop] Use C++17 standard by default
2024-04-03 19:13:03 +01:00
Egor Zhdan
1be7230876 [cxx-interop] Use C++17 standard by default
Clang is using C++17 standard version by default since Clang 16.

Swift’s ClangImporter should do the same, to make sure that clients who run clang and then swiftc without explicit std version see consistent behavior.

rdar://125777068
2024-04-02 16:23:32 +01:00