Skip to content

Commit f420456

Browse files
committed
[cxx-interop] Allow using non-resilient C++ symbols in resilient overlays
If a Swift module built with library evolution enabled is an overlay of a C++ module, allow referring to the non-resilient C++ symbols from the Swift code. Overlays are usually built and shipped along with the C/C++ modules, so library evolution is less of a concern there. A developer providing a Swift overlay for a C++ library would expect to be able to refer to the symbols from the C++ library within the overlay.
1 parent c690fef commit f420456

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/Sema/TypeCheckAccess.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,10 @@ swift::getDisallowedOriginKind(const Decl *decl,
20022002
if (SF->getASTContext().LangOpts.EnableCXXInterop && where.getDeclContext() &&
20032003
where.getDeclContext()->getAsDecl() &&
20042004
where.getDeclContext()->getAsDecl()->getModuleContext()->isResilient() &&
2005+
!where.getDeclContext()
2006+
->getAsDecl()
2007+
->getModuleContext()
2008+
->getUnderlyingModuleIfOverlay() &&
20052009
decl->hasClangNode() && !decl->getModuleContext()->isSwiftShimsModule() &&
20062010
isFragileClangNode(decl->getClangNode()) &&
20072011
!SF->getASTContext().LangOpts.hasFeature(

stdlib/public/Cxx/std/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
5555
SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
5656
-cxx-interoperability-mode=default
5757
-Xfrontend -module-interface-preserve-types-as-written
58-
-enable-experimental-feature AssumeResilientCxxTypes
5958

6059
# The varying modularization of the C++ standard library on different
6160
# platforms makes it difficult to enable MemberImportVisibility for this

0 commit comments

Comments
 (0)