File tree Expand file tree Collapse file tree 3 files changed +15
-1
lines changed
include/swift/ClangImporter Expand file tree Collapse file tree 3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -611,6 +611,9 @@ class ClangImporter final : public ClangModuleLoader {
611611 // / Enable the symbolic import experimental feature for the given callback.
612612 void withSymbolicFeatureEnabled (llvm::function_ref<void (void )> callback);
613613
614+ // / Returns true when the symbolic import experimental feature is enabled.
615+ bool isSymbolicImportEnabled () const ;
616+
614617 const clang::TypedefType *getTypeDefForCXXCFOptionsDefinition (
615618 const clang::Decl *candidateDecl) override ;
616619
Original file line number Diff line number Diff line change @@ -4789,6 +4789,12 @@ static clang::CXXMethodDecl *synthesizeCxxBaseMethod(
47894789 bool isVirtualCall = false ) {
47904790 auto &clangCtx = impl.getClangASTContext ();
47914791 auto &clangSema = impl.getClangSema ();
4792+ // When emitting symbolic decls, the method might not have a concrete
4793+ // record type as this type.
4794+ if (impl.isSymbolicImportEnabled ()
4795+ && !method->getThisType ()->getPointeeCXXRecordDecl ()) {
4796+ return nullptr ;
4797+ }
47924798
47934799 // Create a new method in the derived class that calls the base method.
47944800 clang::DeclarationName name = method->getNameInfo ().getName ();
@@ -7454,6 +7460,10 @@ void ClangImporter::withSymbolicFeatureEnabled(
74547460 oldImportSymbolicCXXDecls.get ());
74557461}
74567462
7463+ bool ClangImporter::isSymbolicImportEnabled () const {
7464+ return Impl.importSymbolicCXXDecls ;
7465+ }
7466+
74577467const clang::TypedefType *ClangImporter::getTypeDefForCXXCFOptionsDefinition (
74587468 const clang::Decl *candidateDecl) {
74597469
Original file line number Diff line number Diff line change @@ -3723,7 +3723,8 @@ namespace {
37233723 decl->getParent (), decl->getParent (), decl);
37243724
37253725 // call the __synthesizedVirtualCall_ C++ thunk from a Swift thunk
3726- if (Decl *swiftThunk = VisitCXXMethodDecl (cxxThunk);
3726+ if (Decl *swiftThunk =
3727+ cxxThunk ? VisitCXXMethodDecl (cxxThunk) : nullptr ;
37273728 isa_and_nonnull<FuncDecl>(swiftThunk)) {
37283729 // synthesize the body of the Swift method to call the swiftThunk
37293730 synthesizeForwardingThunkBody (cast<FuncDecl>(method),
You can’t perform that action at this time.
0 commit comments