File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed
test/Interop/Cxx/foreign-reference Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -6767,8 +6767,10 @@ CustomRefCountingOperationResult CustomRefCountingOperation::evaluate(
6767
6767
return {CustomRefCountingOperationResult::immortal, nullptr , name};
6768
6768
6769
6769
llvm::SmallVector<ValueDecl *, 1 > results;
6770
- auto parentModule = ctx.getClangModuleLoader ()->getWrapperForModule (
6771
- swiftDecl->getClangDecl ()->getOwningModule ());
6770
+ auto *clangMod = swiftDecl->getClangDecl ()->getOwningModule ();
6771
+ if (clangMod && clangMod->isSubModule ())
6772
+ clangMod = clangMod->getTopLevelModule ();
6773
+ auto parentModule = ctx.getClangModuleLoader ()->getWrapperForModule (clangMod);
6772
6774
ctx.lookupInModule (parentModule, name, results);
6773
6775
6774
6776
if (results.size () == 1 )
Original file line number Diff line number Diff line change
1
+ // RUN: rm -rf %t
2
+ // RUN: split-file %s %t
3
+ // RUN: %target-swift-frontend -typecheck -I %t/Inputs %t/test.swift -enable-experimental-cxx-interop -disable-availability-checking 2>&1
4
+
5
+ //--- Inputs/module.modulemap
6
+ module Test {
7
+ header " test.h "
8
+ requires cplusplus
9
+
10
+ module sub {
11
+ header " subtest.h "
12
+
13
+ export *
14
+ }
15
+
16
+ export *
17
+ }
18
+
19
+ //--- Inputs/test.h
20
+ // empty file
21
+
22
+ //--- Inputs/subtest.h
23
+ struct
24
+ __attribute__( ( swift_attr ( " import_reference " ) ) )
25
+ __attribute__ ( ( swift_attr ( " retain:retainFn " ) ) )
26
+ __attribute__ ( ( swift_attr ( " release:releaseFn " ) ) )
27
+ RefCounted {
28
+ static RefCounted * create( ) ;
29
+ } ;
30
+
31
+ void retainFn( RefCounted * ) ;
32
+ void releaseFn( RefCounted * ) ;
33
+
34
+ //--- test.swift
35
+
36
+ import Test
37
+
38
+ let x = RefCounted . create ( )
You can’t perform that action at this time.
0 commit comments