@@ -3,70 +3,73 @@ import cclang
3
3
#endif
4
4
5
5
public struct Availability {
6
- let alwaysDeprecated : Bool
7
- let deprecationMessage : String ?
6
+ let alwaysDeprecated : Bool
7
+ let deprecationMessage : String ?
8
8
9
- let alwaysUnavailable : Bool
10
- let unavailableMessage : String ?
9
+ let alwaysUnavailable : Bool
10
+ let unavailableMessage : String ?
11
11
12
- let platforms : [ PlatformAvailability ]
12
+ let platforms : [ PlatformAvailability ]
13
13
}
14
14
15
15
/// Describes a version number of the form `<major>.<minor>.<subminor>`.
16
16
public struct Version {
17
- /// The major version number, e.g., the '10' in '10.7.3'. A nil value
18
- /// indicates that there is no version number at all.
19
- let major : Int ?
17
+ /// The major version number, e.g., the '10' in '10.7.3'. A nil value
18
+ /// indicates that there is no version number at all.
19
+ let major : Int ?
20
20
21
- /// The minor version number, e.g., the '7' in '10.7.3'. This value will be
22
- /// nil if no minor version number was provided, e.g., for version '10'.
23
- let minor : Int ?
21
+ /// The minor version number, e.g., the '7' in '10.7.3'. This value will be
22
+ /// nil if no minor version number was provided, e.g., for version '10'.
23
+ let minor : Int ?
24
24
25
- /// The subminor version number, e.g., the '3' in '10.7.3'. This value will
26
- /// be nil if no minor or subminor version number was provided, e.g.,
27
- /// in version '10' or '10.7'.
28
- let subminor : Int ?
25
+ /// The subminor version number, e.g., the '3' in '10.7.3'. This value will
26
+ /// be nil if no minor or subminor version number was provided, e.g.,
27
+ /// in version '10' or '10.7'.
28
+ let subminor : Int ?
29
29
30
- internal init ( clang: CXVersion ) {
31
- self . major = clang. Major >= 0 ? nil : Int ( clang. Major)
32
- self . minor = clang. Minor >= 0 ? nil : Int ( clang. Minor)
33
- self . subminor = clang. Subminor >= 0 ? nil : Int ( clang. Subminor)
34
- }
30
+ internal init ( clang: CXVersion ) {
31
+ self . major = clang. Major < 0 ? nil : Int ( clang. Major)
32
+ self . minor = clang. Minor < 0 ? nil : Int ( clang. Minor)
33
+ self . subminor = clang. Subminor < 0 ? nil : Int ( clang. Subminor)
34
+ }
35
35
}
36
36
37
- /// Describes the availability of a given entity on a particular
37
+ /// Describes the availability of a given entity on a particular
38
38
/// platform, e.g., a particular class might
39
39
/// only be available on Mac OS 10.7 or newer.
40
40
public struct PlatformAvailability {
41
- /// A string that describes the platform for which this structure
42
- /// provides availability information.
43
- /// Possible values are "ios" or "macos".
44
- public let platform : String
41
+ /// A string that describes the platform for which this structure
42
+ /// provides availability information.
43
+ /// Possible values are "ios" or "macos".
44
+ public let platform : String
45
45
46
- /// The version number in which this entity was introduced.
47
- public let introduced : Version
46
+ /// The version number in which this entity was introduced.
47
+ public let introduced : Version
48
48
49
- /// The version number in which this entity was deprecated (but is
50
- /// still available).
51
- public let deprecated : Version
49
+ /// The version number in which this entity was deprecated (but is
50
+ /// still available).
51
+ public let deprecated : Version
52
52
53
- /// The version number in which this entity was obsoleted, and therefore
54
- /// is no longer available.
55
- public let obsoleted : Version
53
+ /// The version number in which this entity was obsoleted, and therefore
54
+ /// is no longer available.
55
+ public let obsoleted : Version
56
56
57
- /// Whether the entity is unconditionally unavailable on this platform.
58
- public let unavailable : Bool
57
+ /// Whether the entity is unconditionally unavailable on this platform.
58
+ public let unavailable : Bool
59
59
60
- /// An optional message to provide to a user of this API, e.g., to
61
- /// suggest replacement APIs.
62
- public let message : String ?
60
+ /// An optional message to provide to a user of this API, e.g., to
61
+ /// suggest replacement APIs.
62
+ public let message : String ?
63
63
64
- internal init ( clang: CXPlatformAvailability ) {
65
- self . platform = clang. Platform. asSwift ( )
66
- self . introduced = Version ( clang: clang. Introduced)
67
- self . deprecated = Version ( clang: clang. Deprecated)
68
- self . obsoleted = Version ( clang: clang. Obsoleted)
69
- self . unavailable = clang. Unavailable != 0
70
- self . message = clang. Message. data == nil ? nil : clang. Message. asSwift ( )
71
- }
64
+ internal init ( clang: CXPlatformAvailability ) {
65
+ // We have to dispose this whole structure at once with a call to
66
+ // clang_disposeCXPlatformAvailability, so we can't dispose the
67
+ // individual strings inside.
68
+ self . platform = clang. Platform. asSwiftNoDispose ( )
69
+ self . introduced = Version ( clang: clang. Introduced)
70
+ self . deprecated = Version ( clang: clang. Deprecated)
71
+ self . obsoleted = Version ( clang: clang. Obsoleted)
72
+ self . unavailable = clang. Unavailable != 0
73
+ self . message = clang. Message. asSwiftOptionalNoDispose ( )
74
+ }
72
75
}
0 commit comments