Files
swift-mirror/test/Interop/Cxx/foreign-reference/submodule-lookup-retain-release.swift
Alex Lorenz 60fd510744 [interop] lookup FRT retain/release functions in top level module
Lookups in submodules do not work and are explicitly ignored in the clang importer
2023-05-01 18:58:39 -07:00

39 lines
755 B
Swift

// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop -disable-availability-checking 2>&1
//--- Inputs/module.modulemap
module Test {
header "test.h"
requires cplusplus
module sub {
header "subtest.h"
export *
}
export *
}
//--- Inputs/test.h
// empty file
//--- Inputs/subtest.h
struct
__attribute__((swift_attr("import_reference")))
__attribute__((swift_attr("retain:retainFn")))
__attribute__((swift_attr("release:releaseFn")))
RefCounted {
static RefCounted *create();
};
void retainFn(RefCounted *);
void releaseFn(RefCounted *);
//--- test.swift
import Test
let x = RefCounted.create()