mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge remote-tracking branch 'origin/main' into rebranch
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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) &&
|
||||||
|
|||||||
23
test/embedded/extensions.swift
Normal file
23
test/embedded/extensions.swift
Normal 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
|
||||||
Reference in New Issue
Block a user