Commit Graph

16 Commits

Author SHA1 Message Date
Pavel Yaskevich
5d243bd8a2 [IRGen] Move marker protocol stripping from mangleTypeSymbol to mangleTypeForFlatUniqueTypeRef
The original check introduced by https://github.com/apple/swift/pull/71855
is too broad. For concrete metadata we call the runtime demangler so
we need to strip off marker protocols when mangling that string and
`mangleTypeForReflection` already does that.
2024-06-04 21:58:59 -07:00
Pavel Yaskevich
0ab7e12aa2 [IRGen] Strip marker protocols from type symbol's mangling 2024-03-07 13:31:39 -08:00
Alex Lorenz
4858cb6225 [IRGen][interop] do not add 'nocapture' to not bitwise takable types
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++)

rdar://115062687
2023-09-25 17:43:34 -07:00
Arnold Schwaighofer
3b5ebaa46c Fix some tests in IRGen folder 2023-06-21 10:10:32 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Doug Gregor
e937510977 Don't consider marker protocols when mangling associated type refs.
Associated type references can be mangled without reference to the
protocol they are in when there is only one protocol to which the
base type conforms. Because marker protocols can never have associated
types, don't consider them in this computation. This allows marker
protocols to be added more freely to, e.g., generic type requirements.

Fixes rdar://95994469.
2022-07-02 22:46:25 -07:00
Doug Gregor
c5c1e286e0 [AST Mangler] Don't mangle marker protocols in retroactive conformances.
Fixes a crash in IR generation, where we would try to emit metadata
referencing a marker protocol, rdar://92285294.
2022-05-25 21:35:58 -07:00
Doug Gregor
7d7ec9e7d5 Don't emit marker protocols into runtime type metadata.
Marker protocols don't exist at runtime, drop them when mangling a type
for the purposes of runtime type metadata or reflection. Fixes
rdar://82314404.
2021-10-15 17:53:30 -07:00
Doug Gregor
71c38934d3 Fix an incorrect assertion involving existential formation.
This assertion was tripping when the existential involved a marker
protocol, because it was checking for the number of protocols rather
than the number of protocols that require witness tables. Correct the
assertion and add a test.

Fixes rdar://83020734.
2021-09-24 17:05:56 -07:00
Saleem Abdulrasool
3edb39f88e IRGen: repair the test on Windows (NFC) 2021-02-22 09:14:16 -08:00
Erik Eckstein
f2a3f6210d disable IRGen/marker_protocol.swift test for 32 bit. 2021-02-21 17:41:59 +01:00
Doug Gregor
2ff8808e55 Fix test for Linux 2021-02-20 07:59:59 -08:00
Doug Gregor
4808ed3001 [IRGen] Fix miscount for protocol requirements involving marker protocols.
We had an imbalance where we counted conformance requirements to
marker protocols in the number of requirements in a protocol's
requirement signature, but then did not emit the requirement. Don't
count them, either.
2021-02-19 23:39:42 -08:00
Doug Gregor
2493dc9f0f Eliminate more ABI vestigates of marker protocols 2021-02-03 00:09:21 -08:00
Doug Gregor
cca2d2804d Fix test for Windows 2021-02-02 23:01:40 -08:00
Doug Gregor
c9d66f0d35 Add "marker" protocols, indicated by @_marker.
A marker protocol is a protocol with no requirements and with no ABI
footprint. They can be used to indicate semantics, only, and one can
never have values of a marker protocol type.

We still mangle marker protocols when they are used as generic
requirements, because they are a distinguishing characteristic for
overloading, but "no ABI footprint" means no protocol descriptors,
conformance descriptors, or dynamic discovery of any kind.
2021-02-02 21:53:26 -08:00