Files
swift-mirror/test/Interop/Cxx/class/access/swiftify-private-fileid.swift
Gabor Horvath 6eb7057e75 [cxx-interop] Avoid swiftifying private and protected methods
The generated overloads do not get seralized and later on the compiler
crashes due to the missing body of the SILFunction. This PR works this
problem around by not generating these overloads. We plan to address the
serialization issue later.

rdar://152181531
2025-06-06 11:07:01 +01:00

39 lines
1.1 KiB
Swift

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %target-swift-frontend -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -plugin-path %swift-plugin-dir %t/blessed.swift -module-name main -I %t/Inputs -o %t/out -Xcc -std=c++20 -cxx-interoperability-mode=default -enable-experimental-feature SafeInteropWrappers -verify
// REQUIRES: swift_feature_SafeInteropWrappers
// FIXME swift-ci linux tests do not support std::span
// UNSUPPORTED: OS=linux-gnu, OS=linux-android, OS=linux-androideabi
//--- Inputs/swiftify-non-public.h
#pragma once
#include "swift/bridging"
#include <span>
using IntSpan = std::span<const int>;
class SWIFT_PRIVATE_FILEID("main/blessed.swift") MyClass {
private:
void takesSpan(IntSpan s [[clang::noescape]]) {}
};
//--- Inputs/module.modulemap
module SwiftifyNonPublic {
requires cplusplus
header "swiftify-non-public.h"
}
//--- blessed.swift
import CxxStdlib
import SwiftifyNonPublic
extension MyClass {
mutating func passesSpan(_ s: Span<CInt>) {
takesSpan(s) // expected-error {{cannot convert value of type}}
}
}