Skip to content

Commit cb4ddda

Browse files
martinboehmezoecarver
authored andcommitted
Avoid crashing if lldb imports C++ structs without enabling C++ interop.
1 parent c9405fb commit cb4ddda

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/ClangImporter/ImportDecl.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,6 +3505,13 @@ namespace {
35053505
}
35063506

35073507
Decl *VisitCXXRecordDecl(const clang::CXXRecordDecl *decl) {
3508+
// lldb can call this without enabling C++ interop. To avoid crashing in
3509+
// Clang's Sema, fall back to importing this as a plain RecordDecl.
3510+
// FIXME: Fix lldb to enable C++ interop when appropriate, then remove
3511+
// this fallback.
3512+
if (!Impl.SwiftContext.LangOpts.EnableCXXInterop)
3513+
return VisitRecordDecl(decl);
3514+
35083515
auto &clangSema = Impl.getClangSema();
35093516
// Make Clang define the implicit default constructor if the class needs
35103517
// it. Make sure we only do this if the class has been fully defined and

0 commit comments

Comments
 (0)