Skip to content

Commit 1139f46

Browse files
authored
Merge pull request swiftlang#62820 from zoecarver/revert-883a9abf53799591dbb4c074bc3dd682327f3fcb
Revert "[cxx-interop] Fix crash when indexing with C++ interop enabled."
2 parents 107d8ff + 700eb93 commit 1139f46

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,9 +1130,7 @@ static void performEndOfPipelineActions(CompilerInstance &Instance) {
11301130
// FIXME: This predicate matches the status quo, but there's no reason
11311131
// indexing cannot run for actions that do not require stdlib e.g. to better
11321132
// facilitate tests.
1133-
if (FrontendOptions::doesActionRequireSwiftStandardLibrary(action) &&
1134-
// TODO: indexing often crashes when interop is enabled (rdar://87719859).
1135-
!Invocation.getLangOptions().EnableCXXInterop) {
1133+
if (FrontendOptions::doesActionRequireSwiftStandardLibrary(action)) {
11361134
emitIndexData(Instance);
11371135
}
11381136

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
// RUN: %empty-directory(%t)
12
// RUN: %target-swift-frontend %s -c -index-system-modules -index-store-path %t -enable-experimental-cxx-interop
2-
//
3+
// RUN: ls %t/v5/units | %FileCheck %s
4+
35
// REQUIRES: OS=macosx
6+
// REQUIRES: cxx-interop-fixed-cf_options
47

58
import Foundation
69

7-
func test(d: Date) {}
10+
func test(d: Date) {}
11+
12+
// CHECK: Foundation-{{.*}}.pcm

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)