Skip to content

Commit bcaf4a2

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. (cherry picked from commit f420456)
1 parent 3914d25 commit bcaf4a2

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
@@ -50,7 +50,6 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
5050
SWIFT_COMPILE_FLAGS ${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS} ${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
5151
-cxx-interoperability-mode=default
5252
-Xfrontend -module-interface-preserve-types-as-written
53-
-enable-experimental-feature AssumeResilientCxxTypes
5453

5554
SWIFT_COMPILE_FLAGS_LINUX
5655
${SWIFT_SDK_LINUX_CXX_OVERLAY_SWIFT_COMPILE_FLAGS}

0 commit comments

Comments
 (0)