mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[embedded][Concurrency] Fix missing swift_deletedAsyncMethodError
This commit is contained in:
@@ -2129,6 +2129,15 @@ FUNCTION(DeletedMethodError, Swift, swift_deletedMethodError, C_CC, AlwaysAvaila
|
||||
EFFECT(NoEffect),
|
||||
UNKNOWN_MEMEFFECTS)
|
||||
|
||||
// void swift_deletedAsyncMethodError();
|
||||
FUNCTION(DeletedAsyncMethodError, _Concurrency, swift_deletedAsyncMethodError, SwiftAsyncCC,
|
||||
ConcurrencyAvailability,
|
||||
RETURNS(VoidTy),
|
||||
ARGS(),
|
||||
ATTRS(NoUnwind),
|
||||
EFFECT(Concurrency),
|
||||
UNKNOWN_MEMEFFECTS)
|
||||
|
||||
FUNCTION(AllocError, Swift, swift_allocError, SwiftCC, AlwaysAvailable,
|
||||
RETURNS(ErrorPtrTy, OpaquePtrTy),
|
||||
ARGS(TypeMetadataPtrTy, WitnessTablePtrTy, OpaquePtrTy, Int1Ty),
|
||||
|
||||
@@ -3863,8 +3863,11 @@ IRGenModule::getAddrOfLLVMVariable(LinkEntity entity,
|
||||
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
|
||||
|
||||
// Clang may have defined the variable already.
|
||||
if (auto existing = Module.getNamedGlobal(link.getName()))
|
||||
return getElementBitCast(existing, defaultType);
|
||||
if (auto existing = Module.getNamedGlobal(link.getName())) {
|
||||
auto var = getElementBitCast(existing, defaultType);
|
||||
GlobalVars[entity] = var;
|
||||
return var;
|
||||
}
|
||||
|
||||
const LazyConstantInitializer *lazyInitializer = nullptr;
|
||||
std::optional<ConstantInitBuilder> lazyBuilder;
|
||||
@@ -4003,6 +4006,7 @@ IRGenModule::getAddrOfLLVMVariableOrGOTEquivalent(LinkEntity entity) {
|
||||
getAddrOfLLVMVariable(entity, ConstantInit(), DebugTypeInfo());
|
||||
|
||||
auto entry = GlobalVars[entity];
|
||||
assert(entry);
|
||||
|
||||
/// Returns a direct reference.
|
||||
auto direct = [&]() -> ConstantReference {
|
||||
|
||||
50
test/embedded/concurrency-deleted-method.swift
Normal file
50
test/embedded/concurrency-deleted-method.swift
Normal file
@@ -0,0 +1,50 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -parse-as-library -module-name main %s -emit-ir | %FileCheck --check-prefix=CHECK-IR %s
|
||||
// RUN: %target-swift-frontend -enable-experimental-feature Embedded -parse-as-library -module-name main %s -c -o %t/a.o
|
||||
// RUN: %target-clang %t/a.o -o %t/a.out -L%swift_obj_root/lib/swift/embedded/%target-cpu-apple-macos -lswift_Concurrency -lswift_ConcurrencyDefaultExecutor -dead_strip
|
||||
// RUN: %target-run %t/a.out | %FileCheck %s
|
||||
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: swift_in_compiler
|
||||
// REQUIRES: optimized_stdlib
|
||||
// REQUIRES: OS=macosx
|
||||
// REQUIRES: swift_feature_Embedded
|
||||
|
||||
import _Concurrency
|
||||
|
||||
actor MyActor {
|
||||
var value: Int = 42
|
||||
func foo() async {
|
||||
print("value: \(value)")
|
||||
}
|
||||
|
||||
func thisIsUnused() async {
|
||||
print("unused")
|
||||
}
|
||||
}
|
||||
|
||||
@main struct Main {
|
||||
static func main() async {
|
||||
let n = MyActor()
|
||||
await n.foo()
|
||||
}
|
||||
}
|
||||
|
||||
// CHECK-IR: @swift_deletedAsyncMethodErrorTu =
|
||||
// CHECK-IR: @"$e4main7MyActorCN" = global <{ ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }> <{
|
||||
// CHECK-IR-SAME: ptr null,
|
||||
// CHECK-IR-SAME: ptr @"$e4main7MyActorCfD",
|
||||
// CHECK-IR-SAME: ptr null,
|
||||
// CHECK-IR-SAME: ptr @swift_deletedMethodError,
|
||||
// CHECK-IR-SAME: ptr @swift_deletedMethodError,
|
||||
// CHECK-IR-SAME: ptr @swift_deletedMethodError,
|
||||
// CHECK-IR-SAME: ptr @"$e4main7MyActorC3fooyyYaFTu",
|
||||
// CHECK-IR-SAME: ptr @got.swift_deletedAsyncMethodErrorTu,
|
||||
// CHECK-IR-SAME: ptr @"$e4main7MyActorCACycfC"
|
||||
// CHECK-IR-SAME: }>, align 8
|
||||
|
||||
// CHECK-IR-NOT: $e4main7MyActorC12thisIsUnusedyyYaF
|
||||
|
||||
// CHECK-IR: define swifttailcc void @swift_deletedAsyncMethodError(ptr swiftasync %0)
|
||||
|
||||
// CHECK: value: 42
|
||||
Reference in New Issue
Block a user