@@ -14,7 +14,6 @@ private import _TestingInternals
1414///
1515/// - Parameters:
1616/// - kind: The kind of this record.
17- /// - version: The version of this record.
1817/// - reserved1: Reserved for future use.
1918/// - accessor: A function which, when called, produces the test content.
2019/// - context: Kind-specific context for this record.
@@ -24,16 +23,12 @@ private import _TestingInternals
2423/// directly.
2524public typealias __TestContentRecord = (
2625 kind: UInt32 ,
27- version: UInt16 ,
28- reserved1: UInt16 ,
26+ reserved1: UInt32 ,
2927 accessor: ( @convention ( c) ( _ outValue: UnsafeMutableRawPointer , _ hint: UnsafeRawPointer ? ) -> CBool ) ? ,
3028 context: UInt ,
3129 reserved2: UInt
3230)
3331
34- /// The current version of the `__TestContentRecord` type.
35- private let _currentTestContentRecordVersion = UInt16 ( 0 )
36-
3732/// Resign any pointers in a test content record.
3833///
3934/// - Parameters:
@@ -98,24 +93,12 @@ extension TestContent where Self: ~Copyable {
9893 private static func _testContentRecords( in sectionBounds: SectionBounds ) -> some Sequence < ( imageAddress: UnsafeRawPointer ? , record: __TestContentRecord ) > {
9994 sectionBounds. buffer. withMemoryRebound ( to: __TestContentRecord. self) { records in
10095 records. lazy
101- . filter { $0. version == _currentTestContentRecordVersion }
10296 . filter { $0. kind == testContentKind }
10397 . map ( _resign)
10498 . map { ( sectionBounds. imageAddress, $0) }
10599 }
106100 }
107101
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-
119102 /// Call the given accessor function.
120103 ///
121104 /// - Parameters:
@@ -177,8 +160,10 @@ extension TestContent where Self: ~Copyable {
177160 /// is used with move-only types (specifically ``ExitTest``) and
178161 /// `Sequence.Element` must be copyable.
179162 static func enumerateTestContent( withHint hint: TestContentAccessorHint ? = nil , _ body: TestContentEnumerator ) {
163+ let testContentRecords = SectionBounds . allTestContent. lazy. flatMap ( _testContentRecords ( in: ) )
164+
180165 var stop = false
181- for (imageAddress, record) in _testContentRecords ( ) {
166+ for (imageAddress, record) in testContentRecords {
182167 if let accessor = record. accessor, let result = _callAccessor ( accessor, withHint: hint) {
183168 // Call the callback.
184169 body ( imageAddress, result, record. context, & stop)
0 commit comments