Merge remote-tracking branch 'origin/main' into rebranch

This commit is contained in:
swift-ci
2023-09-25 01:17:00 -07:00
3 changed files with 29 additions and 0 deletions

View File

@@ -5680,6 +5680,10 @@ static bool shouldEmitCategory(IRGenModule &IGM, ExtensionDecl *ext) {
void IRGenModule::emitExtension(ExtensionDecl *ext) { void IRGenModule::emitExtension(ExtensionDecl *ext) {
emitNestedTypeDecls(ext->getMembers()); emitNestedTypeDecls(ext->getMembers());
if (Context.LangOpts.hasFeature(Feature::Embedded)) {
return;
}
addLazyConformances(ext); addLazyConformances(ext);
// Generate a category if the extension either introduces a // Generate a category if the extension either introduces a

View File

@@ -1319,6 +1319,8 @@ bool IRGenerator::canEmitWitnessTableLazily(SILWitnessTable *wt) {
} }
void IRGenerator::addLazyWitnessTable(const ProtocolConformance *Conf) { void IRGenerator::addLazyWitnessTable(const ProtocolConformance *Conf) {
assert(!SIL.getASTContext().LangOpts.hasFeature(Feature::Embedded));
if (auto *wt = SIL.lookUpWitnessTable(Conf)) { if (auto *wt = SIL.lookUpWitnessTable(Conf)) {
// Add it to the queue if it hasn't already been put there. // Add it to the queue if it hasn't already been put there.
if (canEmitWitnessTableLazily(wt) && if (canEmitWitnessTableLazily(wt) &&

View File

@@ -0,0 +1,23 @@
// RUN: %empty-directory(%t)
// RUN: %{python} %utils/split_file.py -o %t %s
// RUN: %target-swift-frontend -emit-module -o %t/MyModule.swiftmodule %t/MyModule.swift -parse-stdlib -enable-experimental-feature Embedded
// RUN: %target-swift-frontend -emit-ir -I %t %t/Main.swift -parse-stdlib -enable-experimental-feature Embedded | %FileCheck %s
// REQUIRES: swift_in_compiler
// BEGIN MyModule.swift
public protocol MyProtocol {}
// BEGIN Main.swift
import MyModule
struct MyStruct {}
extension MyStruct: MyProtocol {}
// CHECK: define {{.*}}i32 @main(i32 %0, ptr %1)
// CHECK-NOT: MyStruct
// CHECK-NOT: MyProtocol