File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -556,6 +556,12 @@ class DeadFunctionAndGlobalElimination {
556556 auto *fd = getBaseMethod (
557557 cast<AbstractFunctionDecl>(entry.getMethod ().getDecl ()));
558558
559+ // In Embedded Swift, we don't expect SILFunction without definitions on
560+ // vtable entries. Having one means the base method was DCE'd already,
561+ // so let's avoid marking it alive in the subclass vtable either.
562+ bool embedded = Module->getOptions ().EmbeddedSwift ;
563+ if (embedded && !F->isDefinition ()) { continue ; }
564+
559565 if (// We also have to check the method declaration's access level.
560566 // Needed if it's a public base method declared in another
561567 // compilation unit (for this we have no SILFunction).
Original file line number Diff line number Diff line change 77// RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
88// RUN: %target-run %t/a.out | %FileCheck %s
99
10+ // RUN: %target-swift-frontend -O -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
11+ // RUN: %target-swift-frontend -O -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
12+ // RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
13+ // RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
14+ // RUN: %target-run %t/a.out | %FileCheck %s
15+
16+ // RUN: %target-swift-frontend -Osize -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
17+ // RUN: %target-swift-frontend -Osize -c -I %t %t/Main.swift -enable-experimental-feature Embedded -o %t/a.o
18+ // RUN: %target-clang -x c -c %S/Inputs/print.c -o %t/print.o
19+ // RUN: %target-clang %t/a.o %t/print.o -o %t/a.out
20+ // RUN: %target-run %t/a.out | %FileCheck %s
21+
1022// REQUIRES: swift_in_compiler
1123// REQUIRES: executable_test
1224// REQUIRES: OS=macosx || OS=linux-gnu
You can’t perform that action at this time.
0 commit comments