Commit Graph

1737 Commits

Author SHA1 Message Date
Jeremy Day
221c7039bd Add explicit OpenSourcesAsVolatile option 2024-07-26 17:02:04 -07:00
swift-ci
b24dc98148 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-24 15:55:32 -07:00
Steven Wu
2bc4080116 [ExplicitModule] Include -Xcc -D into module hash
The decision to exclude `-Xcc -D` options from swift module hash
actually doesn't help to solve the problem. It wouldn't reduce the
module variants (or the number of swiftmodule build commands) because
the command-line also encodes all the clang PCM dependencies that do get
affected by `-Xcc` flags.

To avoid the false sharing and the nondeterministic build products,
include most of the `-Xcc` flags, except include search path, into swift
module hash.

rdar://132046247
2024-07-23 14:57:44 -07:00
Jeremy Day
a22419f1d0 Fix sourcekitd persistent file-locks on Windows 2024-07-23 09:59:41 -07:00
swift-ci
538d700717 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-17 22:45:20 -07:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
swift-ci
25be15072e Merge remote-tracking branch 'origin/main' into rebranch 2024-07-11 09:56:08 -07:00
Steven Wu
156b0a9b47 Merge pull request #75133 from cachemeifyoucan/eng/PR-131408266
[Modules] Avoid false swift module sharing
2024-07-11 09:36:23 -07:00
Ben Barham
2715d0e9d6 Merge branch 'main' into 20240710-main-to-rebranch
Conflicts:
  - `test/Interop/Cxx/class/method/methods-this-and-indirect-return-irgen-itanium.swift`
    previously fixed on rebranch, now fixed on main (slightly differently).
2024-07-10 20:42:09 -07:00
Steven Wu
a32dd9539b [Modules] Avoid false swift module sharing
When the swiftmodule is built with different clang importer arguments,
they can have the same module hash, causing them to be wrongly re-used even
they contains different interfaces. Add ReducedExtraArgs to the module hash to
disambiguate them.

However, some Xcc arguments, most commonly `-D` options do not affect the
swiftmodule being generated. Do not pass `-Xcc -DARGS` to swift
interface compilation to reduce the amount of module variants in the
build.

rdar://131408266
2024-07-10 14:48:12 -07:00
Tim Kientzle
55663f6791 Merge branch 'main' into tbkka-assertions-3 2024-07-10 14:20:50 -07:00
Rintaro Ishizaki
90c2975d66 [Basic] Don't rewrite source buffer copy multiple times
The on-disc buffer file name was not recorded correctly.

rdar://130478685
2024-07-09 15:09:30 -07:00
swift-ci
d57c885419 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-08 10:55:11 -07:00
Carl Peto
ee57481d7c [AVR] AVR support - Initial PR
- Add simple support for the AVR architecture, as a supported conditional compilation value, and added to the default llvm targets to build.

(Later PRs will fix support for 16-bit pointers, which is broken in places, and any fixes needed to get the standard library to build.)

(Note: AVR as a target is expected to always be compiled with -enable-experimental-feature Embedded.)
2024-07-06 18:22:10 +01:00
swift-ci
517860f681 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-25 23:55:09 -07:00
eeckstein
b68c55cd90 Merge pull request #74685 from eeckstein/assertion-improvements
Some assertion improvements
2024-06-26 08:45:50 +02:00
swift-ci
c2637adbfb Merge remote-tracking branch 'origin/main' into rebranch 2024-06-25 18:14:25 -07:00
Tim Kientzle
50b2b1bcdc Only print the last component of the filename
In particular, on Windows MSVC, the ASSERT macros
use `__FILE__` (with the full pathname) instead of
`__FILE_NAME__` (with only the last component).
2024-06-25 15:18:39 -07:00
John McCall
6a73d244c3 Implement getSwiftRuntimeCompatibilityVersionForTarget for recent releases
We were relying on this for `@isolated(any)` mangling suppression, but
it actually doesn't generate correct results for recent deployment targets.
As a result, we treated e.g. macOS 14.4 as if it were completely
unconstrained in terms of runtime availability.

I took this data from availability-macros.def; it's unfortunate that
we can't just generate the implementation directly from that.

Fixes rdar://129861211
2024-06-25 13:25:56 -04:00
Erik Eckstein
1f29622f08 Assertions: display the assertion help hint only once and after the assertion message
It's more readable if the first thing which is printed is the actual assertion message
2024-06-25 14:16:22 +02:00
Erik Eckstein
81005c18a2 SwiftCompilerSources: forward assertion and precondition failures to the assertion-handling in the C++ code base. 2024-06-25 14:14:43 +02:00
swift-ci
54c3771c92 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-22 14:34:31 -07:00
Slava Pestov
b366ae238c Basic: Use llvm streams instead of iostream in Assertions.cpp 2024-06-22 08:53:22 -04:00
swift-ci
45f211ca23 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-20 16:36:43 -07:00
Tim Kientzle
174983f619 Merge pull request #74581 from tbkka/tbkka-assertions-2
Minor improvements to new ASSERT macros
2024-06-20 16:34:23 -07:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -07:00
Tim Kientzle
967fde0750 Minor improvements to new ASSERT macros
Three minor changes:
* Remove unneeded stdint.h inclusion
* Use __FILE_NAME__ instead of __FILE__ to reduce code size
* Write location as "file:line" for better compatibility with existing tools
2024-06-20 11:34:36 -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
bc80f1ca21 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-28 17:50:40 -07:00
Tim Kientzle
37e5f30d0b Add some basic assertion handling control options 2024-05-16 15:04:49 -07:00
Tim Kientzle
5b49a04ddc New assertions support
This adds three new assertion macros:
* `ASSERT` - always compiled in, always checked
* `CONDITIONAL_ASSERT` - always compiled in, checked whenever the `-compiler-assertions` flag is provided
* `DEBUG_ASSERT` - only compiled into debug builds, always checked when compiled in  (functionally the same as Standard C `assert`)

The new `-compiler-assertions` flag is recognized by both `swift-frontend` and
`swiftc`.

The goal is to eventually replace every use of `assert` in the compiler with one of the above:
* Most assertions will use `ASSERT` (most assertions should always be present and checked, even in release builds)
* Expensive assertions can use `CONDITIONAL_ASSERT` to be suppressed by default
* A few very expensive and/or brittle assertions can use `DEBUG_ASSERT` to be compiled out of release builds

This should:
* Improve quality by catching errors earlier,
* Accelerate compiler triage and debugging by providing more accurate crash dumps by default, and
* Allow compiler engineers and end users alike to add `-compiler-assertions` to get more accurate failure diagnostics with any compiler
2024-05-16 11:38:00 -07:00
swift-ci
004f0e9666 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-13 16:33:55 -07:00
Kavon Farvardin
0a611e8ded NCGenerics: ensure it's enabled
Regardless of whether someone made it non-experimental, or deleted all
the checks in the compiler, really, truly, make sure the bit is set to
indicate we have the darn feature.
2024-05-13 10:43:25 -07:00
swift-ci
389f10daf1 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-09 20:35:20 -07:00
Rintaro Ishizaki
0a0e665c22 [Macros] Ensure reaping executable plugin process
rdar://126489446
2024-05-09 16:27:01 -07:00
swift-ci
d4e8274d83 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-07 12:33:55 -07:00
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
37f3df4780 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-25 21:14:38 -07:00
Allan Shortlidge
50835e8590 Basic: Add minimum availability version for visionOS.
This fixes an issue where diagnostics were not emitted for missing availability
attributes when compiling for visionOS.

Resolves rdar://127073463
2024-04-25 15:10:51 -07:00
Ben Barham
30ea96064d [Basic] Remove duplicate XROS case 2024-04-23 20:12:48 -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
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
swift-ci
f0e69349aa Merge remote-tracking branch 'origin/main' into rebranch 2024-04-12 18:13:50 -07:00
Konrad `ktoso` Malawski
54229549b3 [Distributed] Offer fixit for import Distributed when it is required (#72948) 2024-04-12 18:05:32 -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
Ben Barham
2fc51affb2 [Basic] Handle added/removed triples
Ananas/CloudABI/Contiki/Minix have all been removed from LLVM (in
various commits).

Also adds minimal (ie. necessary for compiling) support for the new
triples.
2024-04-08 08:58:58 -07:00
Ben Barham
1fdda023b3 Rename StringRef::endswith references to StringRef::ends_with
Missed this when doing the `startswith` renaming. `endswith` has also
been deprecated upstream (and presumably soon to be removed).
2024-04-01 10:59:16 -07:00
Yuta Saito
7441e039d0 wasm: Add "_multithreaded" as valid _runtime argument
This patch adds "_multithreaded" as a valid `_runtime` argument and
sets it when the target is `wasm32-unknown-wasi-threads` or other
non-none OS targets.
2024-03-29 06:30:18 +00:00
Doug Gregor
922e3daaea Remove build infrastructure for globally enabling noncopyable types
Now that the compilation model of noncopyable types is enabled everywhere,
and one can enable the feature for specific modules, we no longer need a
separate build-script/CMake option to enable it globally. Remove it all.
2024-03-19 13:35:31 -07:00
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