mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The embedded shell script in the RUN command for lit is problematic for non-sh shell environments (i.e. Windows). This adjusts the tests to uniformly build the code for the ObjC runtime. However, the Objective-C code is only built under the same circumstances that it is currently enabled - the availability of the needed frameworks. The empty object on other runtimes will have no material impact. The swift side of it checks whether the runtime is built with ObjC interop. This allows us to largely use the same command line for all the targets. The last missing piece is that the `-fobjc-runtime` requires that we run a modern ObjC runtime. We enable this unconditionally in lit for the non-Apple targets. This improves the validation test coverage for the standard library on Windows.
23 lines
612 B
Objective-C
23 lines
612 B
Objective-C
|
|
#if __has_include(<Foundation/Foundation.h>)
|
|
#include <Foundation/Foundation.h>
|
|
|
|
void slurpFastEnumerationOfArrayFromObjCImpl(id Array, id<NSFastEnumeration> FE,
|
|
NSMutableArray *Values) {
|
|
NSArray *NSA = Array;
|
|
for (NSObject *Value in FE) {
|
|
[Values addObject: Value];
|
|
}
|
|
}
|
|
|
|
void slurpFastEnumerationOfDictionaryFromObjCImpl(
|
|
id Dictionary, id<NSFastEnumeration> FE, NSMutableArray *KeyValuePairs) {
|
|
NSDictionary *NSD = Dictionary;
|
|
for (NSObject *Key in FE) {
|
|
[KeyValuePairs addObject: Key];
|
|
[KeyValuePairs addObject: NSD[Key]];
|
|
}
|
|
}
|
|
#endif
|
|
|