diff --git a/include/swift/Runtime/Config.h b/include/swift/Runtime/Config.h index 4aa806a5a50da..80326e1f3341f 100644 --- a/include/swift/Runtime/Config.h +++ b/include/swift/Runtime/Config.h @@ -168,6 +168,14 @@ extern uintptr_t __COMPATIBILITY_LIBRARIES_CANNOT_CHECK_THE_IS_SWIFT_BIT_DIRECTL // Bring in visibility attribute macros #include "swift/shims/Visibility.h" +// Temporary definitions to allow compilation on clang-15. +#if defined(__cplusplus) +#define SWIFT_EXTERN_C extern "C" +#else +#define SWIFT_EXTERN_C +#endif +#define SWIFT_RUNTIME_EXPORT_ATTRIBUTE SWIFT_EXPORT_FROM_ATTRIBUTE(swiftCore) + // Define mappings for calling conventions. // Annotation for specifying a calling convention of diff --git a/include/swift/Runtime/Heap.h b/include/swift/Runtime/Heap.h index 4b7f50fb0899a..c9c6cbff10a77 100644 --- a/include/swift/Runtime/Heap.h +++ b/include/swift/Runtime/Heap.h @@ -29,7 +29,7 @@ namespace swift { // Never returns nil. The returned memory is uninitialized. // // An "alignment mask" is just the alignment (a power of 2) minus 1. -SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT +SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE void *swift_slowAlloc(size_t bytes, size_t alignMask); // If the caller cannot promise to zero the object during destruction, diff --git a/include/swift/Runtime/HeapObject.h b/include/swift/Runtime/HeapObject.h index c0de2f46ff2de..62c178285d2a9 100644 --- a/include/swift/Runtime/HeapObject.h +++ b/include/swift/Runtime/HeapObject.h @@ -61,7 +61,7 @@ struct OpaqueValue; /// /// POSSIBILITIES: The argument order is fair game. It may be useful /// to have a variant which guarantees zero-initialized memory. -SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT +SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE HeapObject *swift_allocObject(HeapMetadata const *metadata, size_t requiredSize, size_t requiredAlignmentMask); @@ -117,7 +117,7 @@ BoxPair swift_makeBoxUnique(OpaqueValue *buffer, Metadata const *type, size_t alignMask); /// Returns the address of a heap object representing all empty box types. -SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT +SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE HeapObject* swift_allocEmptyBox(); /// Atomically increments the retain count of an object. diff --git a/include/swift/Runtime/Metadata.h b/include/swift/Runtime/Metadata.h index 9114d7462ccc4..edc55608e454a 100644 --- a/include/swift/Runtime/Metadata.h +++ b/include/swift/Runtime/Metadata.h @@ -313,7 +313,7 @@ swift_getGenericMetadata(MetadataRequest request, /// - installing new v-table entries and overrides; and /// - registering the class with the runtime under ObjC interop. /// Most of this work can be achieved by calling swift_initClassMetadata. -SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT +SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE ClassMetadata * swift_allocateGenericClassMetadata(const ClassDescriptor *description, const void *arguments, @@ -322,7 +322,7 @@ swift_allocateGenericClassMetadata(const ClassDescriptor *description, /// Allocate a generic value metadata object. This is intended to be /// called by the metadata instantiation function of a generic struct or /// enum. -SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT +SWIFT_EXTERN_C SWIFT_RETURNS_NONNULL SWIFT_NODISCARD SWIFT_RUNTIME_EXPORT_ATTRIBUTE ValueMetadata * swift_allocateGenericValueMetadata(const ValueTypeDescriptor *description, const void *arguments,