1515
1616#include "swift/Basic/Compiler.h"
1717
18- #include <inttypes .h>
19- #include <stdbool.h>
20- #include <stddef.h>
21- #include <stdint.h>
18+ // NOTE: DO NOT #include any stdlib headers here. e.g. <stdint .h>. Those are
19+ // part of "Darwin"/"Glibc" module, so when a Swift file imports this header,
20+ // it causes importing the "Darwin"/"Glibc" overlay module. That violates
21+ // layering. i.e. Darwin overlay is created by Swift compiler.
2222
2323#if __clang__
2424// Provide macros to temporarily suppress warning about the use of
@@ -41,11 +41,14 @@ SWIFT_BEGIN_NULLABILITY_ANNOTATIONS
4141
4242#ifdef __cplusplus
4343extern "C" {
44+
45+ #define _Bool bool
46+
4447#endif
4548
4649typedef struct BridgedData {
4750 const char * _Nullable baseAddress ;
48- size_t size ;
51+ unsigned long size ;
4952} BridgedData ;
5053
5154void BridgedData_free (BridgedData data );
@@ -70,44 +73,44 @@ void JSON_value_serialize(void *valuePtr, BridgedData *result);
7073/// \c JSON_newValue() or \c JSON_deserializedValue() .
7174void JSON_value_delete (void * valuePtr );
7275
73- bool JSON_value_getAsNull (void * valuePtr );
74- bool JSON_value_getAsBoolean (void * valuePtr , bool * result );
75- bool JSON_value_getAsString (void * valuePtr , BridgedData * result );
76- bool JSON_value_getAsDouble (void * valuePtr , double * result );
77- bool JSON_value_getAsInteger (void * valuePtr , int64_t * result );
78- bool JSON_value_getAsObject (void * valuePtr , void * _Nullable * _Nonnull result );
79- bool JSON_value_getAsArray (void * valuePtr , void * _Nullable * _Nonnull result );
80-
81- size_t JSON_object_getSize (void * objectPtr );
82- BridgedData JSON_object_getKey (void * objectPtr , size_t i );
83- bool JSON_object_hasKey (void * objectPtr , const char * key );
76+ _Bool JSON_value_getAsNull (void * valuePtr );
77+ _Bool JSON_value_getAsBoolean (void * valuePtr , _Bool * result );
78+ _Bool JSON_value_getAsString (void * valuePtr , BridgedData * result );
79+ _Bool JSON_value_getAsDouble (void * valuePtr , double * result );
80+ _Bool JSON_value_getAsInteger (void * valuePtr , long long * result );
81+ _Bool JSON_value_getAsObject (void * valuePtr , void * _Nullable * _Nonnull result );
82+ _Bool JSON_value_getAsArray (void * valuePtr , void * _Nullable * _Nonnull result );
83+
84+ unsigned long JSON_object_getSize (void * objectPtr );
85+ BridgedData JSON_object_getKey (void * objectPtr , unsigned long i );
86+ _Bool JSON_object_hasKey (void * objectPtr , const char * key );
8487void * JSON_object_getValue (void * objectPtr , const char * key );
8588
86- int64_t JSON_array_getSize (void * arrayPtr );
87- void * JSON_array_getValue (void * arrayPtr , int64_t index );
89+ long long JSON_array_getSize (void * arrayPtr );
90+ void * JSON_array_getValue (void * arrayPtr , long long index );
8891
8992void JSON_value_emplaceNull (void * valuePtr );
90- void JSON_value_emplaceBoolean (void * valuePtr , bool value );
93+ void JSON_value_emplaceBoolean (void * valuePtr , _Bool value );
9194void JSON_value_emplaceString (void * valuePtr , const char * value );
9295void JSON_value_emplaceDouble (void * valuePtr , double value );
93- void JSON_value_emplaceInteger (void * valuePtr , int64_t value );
96+ void JSON_value_emplaceInteger (void * valuePtr , long long value );
9497void * JSON_value_emplaceNewObject (void * valuePtr );
9598void * JSON_value_emplaceNewArray (void * valuePtr );
9699
97100void JSON_object_setNull (void * objectPtr , const char * key );
98- void JSON_object_setBoolean (void * objectPtr , const char * key , bool value );
101+ void JSON_object_setBoolean (void * objectPtr , const char * key , _Bool value );
99102void JSON_object_setString (void * objectPtr , const char * key , const char * value );
100103void JSON_object_setDouble (void * objectPtr , const char * key , double value );
101- void JSON_object_setInteger (void * objectPtr , const char * key , int64_t value );
104+ void JSON_object_setInteger (void * objectPtr , const char * key , long long value );
102105void * JSON_object_setNewObject (void * objectPtr , const char * key );
103106void * JSON_object_setNewArray (void * objectPtr , const char * key );
104107void * JSON_object_setNewValue (void * objectPtr , const char * key );
105108
106109void JSON_array_pushNull (void * arrayPtr );
107- void JSON_array_pushBoolean (void * arrayPtr , bool value );
110+ void JSON_array_pushBoolean (void * arrayPtr , _Bool value );
108111void JSON_array_pushString (void * arrayPtr , const char * value );
109112void JSON_array_pushDouble (void * arrayPtr , double value );
110- void JSON_array_pushInteger (void * arrayPtr , int64_t value );
113+ void JSON_array_pushInteger (void * arrayPtr , long long value );
111114void * JSON_array_pushNewObject (void * arrayPtr );
112115void * JSON_array_pushNewArray (void * arrayPtr );
113116void * JSON_array_pushNewValue (void * arrayPtr );
0 commit comments