Skip to content

Commit

Permalink
Avoid crashing if lldb imports C++ structs without enabling C++ interop.
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehme authored and zoecarver committed Oct 9, 2020
1 parent c9405fb commit cb4ddda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ClangImporter/ImportDecl.cpp
Expand Up @@ -3505,6 +3505,13 @@ namespace {
}

Decl *VisitCXXRecordDecl(const clang::CXXRecordDecl *decl) {
// lldb can call this without enabling C++ interop. To avoid crashing in
// Clang's Sema, fall back to importing this as a plain RecordDecl.
// FIXME: Fix lldb to enable C++ interop when appropriate, then remove
// this fallback.
if (!Impl.SwiftContext.LangOpts.EnableCXXInterop)
return VisitRecordDecl(decl);

auto &clangSema = Impl.getClangSema();
// Make Clang define the implicit default constructor if the class needs
// it. Make sure we only do this if the class has been fully defined and
Expand Down

0 comments on commit cb4ddda

Please sign in to comment.