forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFoundationShims.h
65 lines (54 loc) · 2.14 KB
/
FoundationShims.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//===--- FoundationShims.h - Foundation declarations for core stdlib ------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// In order to prevent a circular module dependency between the core
// standard library and the Foundation overlay, we import these
// declarations as part of SwiftShims.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_STDLIB_SHIMS_FOUNDATIONSHIMS_H
#define SWIFT_STDLIB_SHIMS_FOUNDATIONSHIMS_H
//===--- Layout-compatible clones of Foundation structs -------------------===//
// Ideally we would declare the same names as Foundation does, but
// Swift's module importer is not yet tolerant of the same struct
// coming in from two different Clang modules
// (rdar://problem/16294674). Instead, we copy the definitions here
// and then do horrible unsafeBitCast trix to make them usable where required.
//===----------------------------------------------------------------------===//
#include "SwiftStdint.h"
#ifdef __cplusplus
namespace swift { extern "C" {
#endif
typedef struct {
__swift_intptr_t location;
__swift_intptr_t length;
} _SwiftNSRange;
#ifdef __OBJC2__
typedef struct {
unsigned long state;
id __unsafe_unretained _Nullable * _Nullable itemsPtr;
unsigned long * _Nullable mutationsPtr;
unsigned long extra[5];
} _SwiftNSFastEnumerationState;
#endif
// This struct is layout-compatible with NSOperatingSystemVersion.
typedef struct {
__swift_intptr_t majorVersion;
__swift_intptr_t minorVersion;
__swift_intptr_t patchVersion;
} _SwiftNSOperatingSystemVersion;
SWIFT_RUNTIME_STDLIB_INTERFACE
_SwiftNSOperatingSystemVersion _swift_stdlib_operatingSystemVersion();
#ifdef __cplusplus
}} // extern "C", namespace swift
#endif
#endif // SWIFT_STDLIB_SHIMS_FOUNDATIONSHIMS_H