We would check the SYSTEM_NAME rather than the HOST_SYSTEM_NAME variable
where the former is the host and the latter is the build. The behaviour
is concerning the build and so we would behave incorrectly.
The code to copy the refcounts from the object to a new side table wasn't quite right on 32-bit. Fix it to copy the PureSwiftDealloc field, and if the object is immortal, mark the side table's refcount as immortal too.
rdar://121943608
Don't delete the OS declaration of `exit` because the concurrency shims aren't always imported, and so the shim declaration might not always be available.
Don't override the OS declaration of `exit` in the concurrency shims since we can't just delete the OS one. Instead, set up internal shims just for building Concurrency that forward declares `exit`.
Makes the BSD and `__APPLE__` branches consistent and suppresses the following
warning:
```
warning: pointer is missing a nullability type specifier
```
Merge conflict while removing `nocapture` from
`s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF`. Resolution
was to remove nocapture from the expected output in both cases:
```
// CHECK-LABEL: define swiftcc void @"$s21move_function_dbginfo20addressOnlyValueTestyyxAA1PRzlF"(ptr noalias[-nocapture-] %0, ptr %T, ptr %T.P)
```
Conflict cause: 4858cb6225
This is the same as the original change to this file. The conflict seems
to be due to the next line changing, when moving from llvm.dbg.addr to
llvm.dbg.value.
Conflicts:
test/DebugInfo/move_function_dbginfo.swift
64-bit Windows defines both _WIN64 and _WIN32, so the logic here would
always end up defining 32-bit C types for Swift's `Int` and `UInt`.
Fix the ordering to check for 64-bit first, then 32-bit second.
Note that the SwiftShims version of this code has always been wrong,
but it's completely benign because SwiftShims is only used in the
Swift runtime itself, which is built with Clang (on all platforms),
and doesn't need to go through this code path. Still, we fix it in both
places, so we don't get a nasty surprise if the SwiftShims version of
the header later gets included in a non-Clang C++ compiler.
Header search path for Swift shims is "usr/lib/swift". Don't rely on
clang looking for module maps in immediate subdirectories like "shims"
but add a module map to "usr/lib/swift" sourcing "shims" modules.
rdar://106677321
As a result of https://github.com/llvm/llvm-project/commit/e1b88c8a09be
we should expect it to contain only the major version, not the full one
-- that is, we should expect it to be
```
../lib/clang/CLANG_VERSION_MAJOR
```
instead of
```
../lib/clang/CLANG_VERSION_MAJOR.CLANG_VERSION_MINOR.CLANG_VERSION_PATCH
```
Also update the logic to levarage directly the Clang version -- this can
be different from the LLVM one (as per
ebfc680685)
Addresses rdar://111452821
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:
- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
expands to 1, where it would previously coerce to a string.
- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
left-hand side expands twice.
In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:
- Quoted right-hand side of `STREQUAL` where I was confident it was
intended to be a string literal.
- Removed manual variable expansion on left-hand side of `STREQUAL`,
`MATCHES` and `IN_LIST` where I was confident it was unintended.
Fixes#65028.
Using `SwiftShims` is undesirable - it creates all kinds of build issues,
and means shipping the `_SwiftBacktracing.h` header in the SDK, which is
not necessary.
While we're doing this, add the necessary definitions for reading ELF
and DWARF information.
rdar://110261712
Use `task_read_for_pid()` rather than having the crashing program pass its
own task port through. This opts us in to additional OS security measures
surrounding the use of this call.
rdar://107362003
This ensures that a module built from Swift interface file (and as such interop is disabled),
that references 'exit' (from _SwiftConcurrencyShims module) can resolve the module reference to
'exit' even when it's being imported when interop is enabled (and thus it loads a different underlying _SwiftConcurrencyShims).
This is needed because we can't include `<stdint.h>` or `<inttypes.h>`
on Darwin without dragging in the Darwin package.
The previous solution was some icky `#define` nonsense. This is
better.
rdar://106234311