Skip to content

Commit 566c71f

Browse files
committed
Fix handling of Swift(U)Int for Windows
1 parent 5927527 commit 566c71f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

include/swift/Basic/CBasicBridging.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535

3636
// Clang has been defining __INTxx_TYPE__ macros for a long time.
3737
// __UINTxx_TYPE__ are defined only since Clang 3.5.
38-
#if !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) && !defined(__wasi__)
38+
#if defined(_MSC_VER) && !defined(__clang__)
39+
typedef __int64 __swiftc_int64_t;
40+
typedef unsigned __int64 __swiftc_uint64_t;
41+
typedef int __swiftc_int32_t;
42+
typedef unsigned int __swiftc_uint32_t;
43+
#elif !defined(__APPLE__) && !defined(__linux__) && !defined(__OpenBSD__) && !defined(__wasi__)
3944
#include <stdint.h>
4045
typedef int64_t __swiftc_int64_t;
4146
typedef uint64_t __swiftc_uint64_t;

lib/ASTGen/Sources/LLVMJSON/LLVMJSON.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public struct LLVMJSON {
4141

4242
/// Decode a JSON data to a Swift value.
4343
public static func decode<T: Decodable>(_ type: T.Type, from json: UnsafeBufferPointer<Int8>) throws -> T {
44-
let data = BridgedData(baseAddress: json.baseAddress, size: UInt(json.count))
44+
let data = BridgedData(baseAddress: json.baseAddress, size: SwiftUInt(json.count))
4545
let valuePtr = JSON_deserializedValue(data)
4646
defer { JSON_value_delete(valuePtr) }
4747

0 commit comments

Comments
 (0)