mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
CF_OPTIONS is defined differently in the SDK based on a __cplusplus preprocessor branch. As a result, declarations referencing CF_OPTIONS are mangled differently depending on if C++ interop is enabled. This meant a module compiled with cxx interop on could not be linked with a module compiled without and vice versa. This patch modifies the mangler such that the mangled names are consistent. This is achieved by feeding the mangler a modified AST node that looks like the Objective-C definition of CF_OPTIONS, even when we have cxx interop enabled.
17 lines
638 B
Swift
17 lines
638 B
Swift
// RUN: %empty-directory(%t/cache)
|
|
// RUN: %target-swift-frontend %s -I %S/Inputs -c -enable-experimental-cxx-interop -o %t/object.o
|
|
// RUN: %llvm-nm %t/object.o > %t/results.txt
|
|
// RUN: %target-swift-frontend %s -I %S/Inputs -c -enable-objc-interop -o %t/object.o
|
|
// RUN: %llvm-nm %t/object.o >> %t/results.txt
|
|
// RUN: cat %t/results.txt | %FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
|
|
import CFAvailability
|
|
|
|
// Verify that this functions linkage name is the name with or without cxx interop enabled
|
|
public func useNSOption(foo param: StandardNSOption) {}
|
|
|
|
// CHECK: [[FUNC_LINKAGE_NAME:\$s.*useNSOption.*$]]
|
|
// CHECK: [[FUNC_LINKAGE_NAME]]
|