Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2023-10-05 14:33:21 -07:00
13 changed files with 65 additions and 187 deletions

View File

@@ -16,73 +16,8 @@
#include "swift/Basic/Compiler.h"
#include "swift/Basic/Nullability.h"
// NOTE: DO NOT #include any stdlib headers here. e.g. <stdint.h>. Those are
// part of "Darwin"/"Glibc" module, so when a Swift file imports this header,
// it causes importing the "Darwin"/"Glibc" overlay module. That violates
// layering. i.e. Darwin overlay is created by Swift compiler.
// NOTE: Partially ported from SwiftShim's SwiftStdint.h. We cannot include
// that header here because it belongs to the runtime, but we need the same
// logic for interoperability with Swift code in the compiler itself.
// stdint.h is provided by Clang, but it dispatches to libc's stdint.h. As a
// result, using stdint.h here would pull in Darwin module (which includes
// libc). This creates a dependency cycle, so we can't use stdint.h in
// SwiftShims.
// On Linux, the story is different. We get the error message
// "/usr/include/x86_64-linux-gnu/sys/types.h:146:10: error: 'stddef.h' file not
// found"
// This is a known Clang/Ubuntu bug.
// Clang has been defining __INTxx_TYPE__ macros for a long time.
// __UINTxx_TYPE__ are defined only since Clang 3.5.
#if defined(_MSC_VER) && !defined(__clang__)
typedef __int64 __swiftc_int64_t;
typedef unsigned __int64 __swiftc_uint64_t;
typedef int __swiftc_int32_t;
typedef unsigned int __swiftc_uint32_t;
#elif !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) && !defined(__wasi__)
#include <stddef.h>
#include <stdint.h>
typedef int64_t __swiftc_int64_t;
typedef uint64_t __swiftc_uint64_t;
typedef int32_t __swiftc_int32_t;
typedef uint32_t __swiftc_uint32_t;
typedef intptr_t __swiftc_intptr_t;
typedef uintptr_t __swiftc_uintptr_t;
#else
typedef __INT64_TYPE__ __swiftc_int64_t;
#ifdef __UINT64_TYPE__
typedef __UINT64_TYPE__ __swiftc_uint64_t;
#else
typedef unsigned __INT64_TYPE__ __swiftc_uint64_t;
#endif
typedef __INT32_TYPE__ __swiftc_int32_t;
#ifdef __UINT32_TYPE__
typedef __UINT32_TYPE__ __swiftc_uint32_t;
#else
typedef unsigned __INT32_TYPE__ __swiftc_uint32_t;
#endif
#endif
#define __swiftc_join3(a,b,c) a ## b ## c
#define __swiftc_intn_t(n) __swiftc_join3(__swiftc_int, n, _t)
#define __swiftc_uintn_t(n) __swiftc_join3(__swiftc_uint, n, _t)
#if defined(_MSC_VER) && !defined(__clang__)
#if defined(_WIN64)
typedef __swiftc_int64_t SwiftInt;
typedef __swiftc_uint64_t SwiftUInt;
#elif defined(_WIN32)
typedef __swiftc_int32_t SwiftInt;
typedef __swiftc_uint32_t SwiftUInt;
#else
#error unknown windows pointer width
#endif
#else
typedef __swiftc_intn_t(__INTPTR_WIDTH__) SwiftInt;
typedef __swiftc_uintn_t(__INTPTR_WIDTH__) SwiftUInt;
#endif
SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
@@ -103,7 +38,7 @@ SWIFT_BEGIN_ASSUME_NONNULL
typedef struct BridgedData {
const char *_Nullable baseAddress;
SwiftUInt size;
size_t size;
} BridgedData;
void BridgedData_free(BridgedData data);
@@ -132,23 +67,23 @@ _Bool JSON_value_getAsNull(void *valuePtr);
_Bool JSON_value_getAsBoolean(void *valuePtr, _Bool *result);
_Bool JSON_value_getAsString(void *valuePtr, BridgedData *result);
_Bool JSON_value_getAsDouble(void *valuePtr, double *result);
_Bool JSON_value_getAsInteger(void *valuePtr, long long *result);
_Bool JSON_value_getAsInteger(void *valuePtr, int64_t *result);
_Bool JSON_value_getAsObject(void *valuePtr, void *_Nullable *_Nonnull result);
_Bool JSON_value_getAsArray(void *valuePtr, void *_Nullable *_Nonnull result);
unsigned long JSON_object_getSize(void *objectPtr);
BridgedData JSON_object_getKey(void *objectPtr, unsigned long i);
size_t JSON_object_getSize(void *objectPtr);
BridgedData JSON_object_getKey(void *objectPtr, size_t i);
_Bool JSON_object_hasKey(void *objectPtr, const char *key);
void *JSON_object_getValue(void *objectPtr, const char *key);
long long JSON_array_getSize(void *arrayPtr);
void *JSON_array_getValue(void *arrayPtr, long long index);
size_t JSON_array_getSize(void *arrayPtr);
void *JSON_array_getValue(void *arrayPtr, size_t index);
void JSON_value_emplaceNull(void *valuePtr);
void JSON_value_emplaceBoolean(void *valuePtr, _Bool value);
void JSON_value_emplaceString(void *valuePtr, const char *value);
void JSON_value_emplaceDouble(void *valuePtr, double value);
void JSON_value_emplaceInteger(void *valuePtr, long long value);
void JSON_value_emplaceInteger(void *valuePtr, int64_t value);
void *JSON_value_emplaceNewObject(void *valuePtr);
void *JSON_value_emplaceNewArray(void *valuePtr);
@@ -156,7 +91,7 @@ void JSON_object_setNull(void *objectPtr, const char *key);
void JSON_object_setBoolean(void *objectPtr, const char *key, _Bool value);
void JSON_object_setString(void *objectPtr, const char *key, const char *value);
void JSON_object_setDouble(void *objectPtr, const char *key, double value);
void JSON_object_setInteger(void *objectPtr, const char *key, long long value);
void JSON_object_setInteger(void *objectPtr, const char *key, int64_t value);
void *JSON_object_setNewObject(void *objectPtr, const char *key);
void *JSON_object_setNewArray(void *objectPtr, const char *key);
void *JSON_object_setNewValue(void *objectPtr, const char *key);
@@ -165,7 +100,7 @@ void JSON_array_pushNull(void *arrayPtr);
void JSON_array_pushBoolean(void *arrayPtr, _Bool value);
void JSON_array_pushString(void *arrayPtr, const char *value);
void JSON_array_pushDouble(void *arrayPtr, double value);
void JSON_array_pushInteger(void *arrayPtr, long long value);
void JSON_array_pushInteger(void *arrayPtr, int64_t value);
void *JSON_array_pushNewObject(void *arrayPtr);
void *JSON_array_pushNewArray(void *arrayPtr);
void *JSON_array_pushNewValue(void *arrayPtr);