@@ -75,13 +75,13 @@ struct SWTTestContentRecord {
7575};
7676```
7777
78- Do not use the ` __TestContentRecord ` typealias defined in the testing library.
79- This type exists to support the testing library's macros and may change in the
80- future (e.g. to accomodate a generic argument or to make use of one of the
81- reserved fields .)
78+ Do not use the ` __TestContentRecord ` or ` __TestContentRecordAccessor ` typealias
79+ defined in the testing library. These types exist to support the testing
80+ library's macros and may change in the future (e.g. to accomodate a generic
81+ argument or to make use of a reserved field .)
8282
83- Instead, define your own copy of this type where needed&mdash ; you can copy the
84- definition above _ verbatim_ . If your test record type's ` context ` field (as
83+ Instead, define your own copy of these types where needed&mdash ; you can copy the
84+ definitions above _ verbatim_ . If your test record type's ` context ` field (as
8585described below) is a pointer type, make sure to change its type in your version
8686of ` TestContentRecord ` accordingly so that, on systems with pointer
8787authentication enabled, the pointer is correctly resigned at load time.
@@ -108,16 +108,16 @@ other fields in that record are undefined.
108108#### The accessor field
109109
110110The function ` accessor ` is a C function. When called, it initializes the memory
111- at its argument ` outValue ` to an instance of some Swift type and returns ` true ` ,
112- or returns ` false ` if it could not generate the relevant content. On successful
113- return, the caller is responsible for deinitializing the memory at ` outValue `
114- when done with it.
111+ at ` outValue ` to an instance of the appropriate type and returns ` true ` ; or, if
112+ it could not generate the relevant content, it leaves the memory uninitialized
113+ and returns ` false ` . On successful return, the caller is responsible for
114+ deinitializing the memory at ` outValue ` when done with it.
115115
116116If ` accessor ` is ` nil ` , the test content record is ignored. The testing library
117117may, in the future, define record kinds that do not provide an accessor function
118118(that is, they represent pure compile-time information only.)
119119
120- The second argument to this function, ` type ` , is a pointer to the type[ ^ mightNotBeSwift ]
120+ The third argument to this function, ` type ` , is a pointer to the type[ ^ mightNotBeSwift ]
121121(not a bitcast Swift type) of the value expected to be written to ` outValue ` .
122122This argument helps to prevent memory corruption if two copies of Swift Testing
123123or a third-party library are inadvertently loaded into the same process. If the
@@ -131,9 +131,10 @@ accessor function must return `false` and must not modify `outValue`.
131131 other than Swift is beyond the scope of this document. With that in mind, it
132132 is _ technically_ feasible for a test content accessor to be written in (for
133133 example) C++, expect the ` type ` argument to point to a C++ value of type
134- ` std::type_info ` , and write a C++ class instance to ` outValue ` .
134+ [ ` std::type_info ` ] ( https://en.cppreference.com/w/cpp/types/type_info ) , and
135+ write a C++ class instance to ` outValue ` using [ placement ` new ` ] ( https://en.cppreference.com/w/cpp/language/new#Placement_new ) .
135136
136- The third argument to this function, ` hint ` , is an optional input that can be
137+ The fourth argument to this function, ` hint ` , is an optional input that can be
137138passed to help the accessor function determine if its corresponding test content
138139record matches what the caller is looking for. If the caller passes ` nil ` as the
139140` hint ` argument, the accessor behaves as if it matched (that is, no additional
@@ -170,8 +171,8 @@ by `type`, and the value pointed to by `hint` depend on the kind of record:
170171> and/or [ ` withUnsafePointer(to:_:) ` ] ( https://developer.apple.com/documentation/swift/withunsafepointer(to:_:)-35wrn )
171172> to ensure the pointers passed to ` accessor ` are large enough and are
172173> well-aligned. If they are not large enough to contain values of the
173- > appropriate types (per above), or if ` hint ` points to uninitialized or
174- > incorrectly-typed memory, the result is undefined.
174+ > appropriate types (per above), or if ` type ` or ` hint ` points to uninitialized
175+ > or incorrectly-typed memory, the result is undefined.
175176
176177#### The context field
177178
0 commit comments