@@ -14,7 +14,6 @@ private import _TestingInternals
14
14
///
15
15
/// - Parameters:
16
16
/// - kind: The kind of this record.
17
- /// - version: The version of this record.
18
17
/// - reserved1: Reserved for future use.
19
18
/// - accessor: A function which, when called, produces the test content.
20
19
/// - context: Kind-specific context for this record.
@@ -24,16 +23,12 @@ private import _TestingInternals
24
23
/// directly.
25
24
public typealias __TestContentRecord = (
26
25
kind: UInt32 ,
27
- version: UInt16 ,
28
- reserved1: UInt16 ,
26
+ reserved1: UInt32 ,
29
27
accessor: ( @convention ( c) ( _ outValue: UnsafeMutableRawPointer , _ hint: UnsafeRawPointer ? ) -> CBool ) ? ,
30
28
context: UInt ,
31
29
reserved2: UInt
32
30
)
33
31
34
- /// The current version of the `__TestContentRecord` type.
35
- private let _currentTestContentRecordVersion = UInt16 ( 0 )
36
-
37
32
/// Resign any pointers in a test content record.
38
33
///
39
34
/// - Parameters:
@@ -98,24 +93,12 @@ extension TestContent where Self: ~Copyable {
98
93
private static func _testContentRecords( in sectionBounds: SectionBounds ) -> some Sequence < ( imageAddress: UnsafeRawPointer ? , record: __TestContentRecord ) > {
99
94
sectionBounds. buffer. withMemoryRebound ( to: __TestContentRecord. self) { records in
100
95
records. lazy
101
- . filter { $0. version == _currentTestContentRecordVersion }
102
96
. filter { $0. kind == testContentKind }
103
97
. map ( _resign)
104
98
. map { ( sectionBounds. imageAddress, $0) }
105
99
}
106
100
}
107
101
108
- /// Enumerate all test content records found in all test content sections in
109
- /// the current process that match this ``TestContent`` type.
110
- ///
111
- /// - Returns: A sequence of tuples. Each tuple contains an instance of
112
- /// `__TestContentRecord` and the base address of the image containing that
113
- /// test content record. Only test content records matching this
114
- /// ``TestContent`` type's requirements are included in the sequence.
115
- private static func _testContentRecords( ) -> some Sequence < ( imageAddress: UnsafeRawPointer ? , record: __TestContentRecord ) > {
116
- SectionBounds . allTestContent. lazy. flatMap ( _testContentRecords ( in: ) )
117
- }
118
-
119
102
/// Call the given accessor function.
120
103
///
121
104
/// - Parameters:
@@ -177,8 +160,10 @@ extension TestContent where Self: ~Copyable {
177
160
/// is used with move-only types (specifically ``ExitTest``) and
178
161
/// `Sequence.Element` must be copyable.
179
162
static func enumerateTestContent( withHint hint: TestContentAccessorHint ? = nil , _ body: TestContentEnumerator ) {
163
+ let testContentRecords = SectionBounds . allTestContent. lazy. flatMap ( _testContentRecords ( in: ) )
164
+
180
165
var stop = false
181
- for (imageAddress, record) in _testContentRecords ( ) {
166
+ for (imageAddress, record) in testContentRecords {
182
167
if let accessor = record. accessor, let result = _callAccessor ( accessor, withHint: hint) {
183
168
// Call the callback.
184
169
body ( imageAddress, result, record. context, & stop)
0 commit comments