Files
swift-mirror/test/Interop/Cxx/enum/c-enums-NS_OPTIONS-consistent-linkage-name.swift
Nuri Amari 709321b69f Fix ASTMangler mangling NS_OPTION differently in C++ mode
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.
2023-03-09 09:30:05 -08:00

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]]