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 @@ -6761,8 +6761,10 @@ CustomRefCountingOperationResult CustomRefCountingOperation::evaluate(
67616761 return {CustomRefCountingOperationResult::immortal, nullptr , name};
67626762
67636763 llvm::SmallVector<ValueDecl *, 1 > results;
6764- auto parentModule = ctx.getClangModuleLoader ()->getWrapperForModule (
6765- swiftDecl->getClangDecl ()->getOwningModule ());
6764+ auto *clangMod = swiftDecl->getClangDecl ()->getOwningModule ();
6765+ if (clangMod && clangMod->isSubModule ())
6766+ clangMod = clangMod->getTopLevelModule ();
6767+ auto parentModule = ctx.getClangModuleLoader ()->getWrapperForModule (clangMod);
67666768 ctx.lookupInModule (parentModule, name, results);
67676769
67686770 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