This constructor is unsafe, as it allows creating a `std::span` with a count higher than the size of the sequence of objects it refers to. Therefore, when hardening is enabled, an out-of-bounds access won't trap.
We make it deprecated to discourage its use.
In some circumstances the missing trait resulted in picking the wrong
branch of some compile time conditionals resulting in code that would
not compile.
rdar://126709253
While initializing a `std::function` that takes `const std::string&` as a parameter currently crashes, changing the parameter type to `std::string` should work fine.
Previously the code got the declaration for types with generic
arguments and the printer used the declaration. This was a lossy
operation, we printed the type with generic parameters instead of the
arguments. This patch makes sure we print the type with the arguments.
Unfortunately, the code structure is not the most clear, type printing
is currently inherently part of the function signature printing. This
code path needs to be factored out in the future to make the code easier
to understand.
rdar://130679337
The code already forward declared strutcs and enums. This patch extends
the logic to also forward declare classes. Unfortunately, there was some
fallout because some traits ended up defined multiple times for some
classes, so the code is now extended to only conditionally emit these
traits if no forward declaration was emitted for the type yet.
rdar://124022242
This change is necessary to differentiate between C++ const and non-const types in Swift.
For instance, `const int` and `int` would both be printed as `CInt` in Swift.
After this change, `const int` is stored as `CInt_const`
The code wants to avoid exporting certain synthesized operators but it
inadvertently also prevented exporting accessors to static properties.
rdar://115564118
This is a fallout from emitting Swift StdLib dependencies when all
public decls are emitted. This was not found before because the test was
not executed by the CI.
rdar://131556373
Instead of adding opaque fields for the base subobjects this patch
introduces a recursive walk to add all the base fields to the generated
Swift struct.
rdar://126754931
This PR implements proper support for optional generic associated values
in enum cases. Most of the code changes are supporting generic types in
more contexts in the printer, the rest are making sure we handle the
null pointer case when we try to get the declaration from the type that
represents a generic parameter.
rdar://131112273
Clang now includes concepts in the mangled names of C++ functions: 4b163e343c
This adjusts the test to verify that we don't transitively emit the symbols referenced from the requires expression. Those symbols shouldn't be emitted because they are not executed.
rdar://127263407
If a C++ `struct Base` declares a method with a Clang attribute that Swift is able to import, and `struct Derived` inherits from `Base`, the method should get cloned from `Base` to `Derived` with its attributes.
Previously we were only cloning one attribute at most due to a bug in `cloneImportedAttributes`. DeclAttributes is an intrusively linked list, and it was being made invalid while iterating over it: `otherDecl->getAttrs().add(attrs)` iterates over the list and calls `otherDecl->add(eachElement)`, which invalidates the iterator after the first iteration.
This fixes `Interop/Cxx/class/method/methods-this-and-indirect-return-irgen-itanium.swift` by adjusting the expected function signature.
On rebranch, the actual signature is:
```
define linkonce_odr void @_ZN10HasMethods28nonConstPassThroughAsWrapperEi(ptr dead_on_unwind noalias writable sret(%struct.NonTrivialInWrapper) align 4 %agg.result, ptr noundef nonnull align 1 dereferenceable(1) %this, i32 noundef %a)
```
rdar://127263407
This fixes `Interop/Cxx/class/returns-large-class-irgen.swift` by adjusting the expected function signature.
On rebranch, the actual signature is:
```
define void @_Z21funcReturnsLargeClassv(ptr dead_on_unwind noalias writable sret(%struct.LargeClass) align 8 %agg.result)
```
rdar://127263407
Unfortunately, we cannot generate the C++ code for them just yet. There
will be a follow-up PR to actually fix the underlying issue and expose
such enums correctly.
rdar://129250756
The generated header would not compile without these dependencies. Moreover
users probably expect all-public option to be the most permissive filter
including the maximal amount of declarations.