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 {
611
611
// / Enable the symbolic import experimental feature for the given callback.
612
612
void withSymbolicFeatureEnabled (llvm::function_ref<void (void )> callback);
613
613
614
+ // / Returns true when the symbolic import experimental feature is enabled.
615
+ bool isSymbolicImportEnabled () const ;
616
+
614
617
const clang::TypedefType *getTypeDefForCXXCFOptionsDefinition (
615
618
const clang::Decl *candidateDecl) override ;
616
619
Original file line number Diff line number Diff line change @@ -4789,6 +4789,12 @@ static clang::CXXMethodDecl *synthesizeCxxBaseMethod(
4789
4789
bool isVirtualCall = false ) {
4790
4790
auto &clangCtx = impl.getClangASTContext ();
4791
4791
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
+ }
4792
4798
4793
4799
// Create a new method in the derived class that calls the base method.
4794
4800
clang::DeclarationName name = method->getNameInfo ().getName ();
@@ -7454,6 +7460,10 @@ void ClangImporter::withSymbolicFeatureEnabled(
7454
7460
oldImportSymbolicCXXDecls.get ());
7455
7461
}
7456
7462
7463
+ bool ClangImporter::isSymbolicImportEnabled () const {
7464
+ return Impl.importSymbolicCXXDecls ;
7465
+ }
7466
+
7457
7467
const clang::TypedefType *ClangImporter::getTypeDefForCXXCFOptionsDefinition (
7458
7468
const clang::Decl *candidateDecl) {
7459
7469
Original file line number Diff line number Diff line change @@ -3723,7 +3723,8 @@ namespace {
3723
3723
decl->getParent (), decl->getParent (), decl);
3724
3724
3725
3725
// call the __synthesizedVirtualCall_ C++ thunk from a Swift thunk
3726
- if (Decl *swiftThunk = VisitCXXMethodDecl (cxxThunk);
3726
+ if (Decl *swiftThunk =
3727
+ cxxThunk ? VisitCXXMethodDecl (cxxThunk) : nullptr ;
3727
3728
isa_and_nonnull<FuncDecl>(swiftThunk)) {
3728
3729
// synthesize the body of the Swift method to call the swiftThunk
3729
3730
synthesizeForwardingThunkBody (cast<FuncDecl>(method),
You can’t perform that action at this time.
0 commit comments