Skip to content

Commit 700eb93

Browse files
committed
[interop] update import-foundation-with-indexing.swift to only run on SDK with fixed CF_OPTIONS
1 parent 0eca9f7 commit 700eb93

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

test/Interop/Cxx/stdlib/import-foundation-with-indexing.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: ls %t/v5/units | %FileCheck %s
44

55
// REQUIRES: OS=macosx
6+
// REQUIRES: cxx-interop-fixed-cf_options
67

78
import Foundation
89

test/Interop/lit.local.cfg

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ def get_target_os():
99
clang_compile_opt = '-I' + config.swiftlib_dir + ' '
1010
clang_opt = clang_compile_opt
1111

12+
is_cf_options_interop_updated = True
13+
14+
if config.variant_sdk and config.variant_sdk != "":
15+
# Check if CF_OPTIONS macro has been updated to be imported into Swift in C++ mode correctly.
16+
cf_avail_path = os.path.join(config.variant_sdk, 'System', 'Library', 'Frameworks', 'CoreFoundation.framework', 'Versions', 'A', 'Headers', 'CFAvailability.h')
17+
if os.path.exists(cf_avail_path):
18+
with open(cf_avail_path, 'r') as file:
19+
contents = file.read()
20+
import re
21+
regex = r'^#define CF_OPTIONS\(_type, _name\) _type _name; enum __CF_OPTIONS_ATTRIBUTES'
22+
if re.search(regex, contents, re.MULTILINE):
23+
is_cf_options_interop_updated = False
24+
25+
if is_cf_options_interop_updated:
26+
config.available_features.add('cxx-interop-fixed-cf_options')
27+
1228
if get_target_os() in ['windows-msvc']:
1329
config.substitutions.insert(0, ('%target-abi', 'WIN'))
1430
# Clang should build object files with link settings equivalent to -libc MD

0 commit comments

Comments
 (0)