Skip to content

Commit e9259a4

Browse files
[Clang] fix coroutine await suspend wrapper linkage types (#151224)
1 parent f2a476d commit e9259a4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/lib/CodeGen/CGCoroutine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ CodeGenFunction::generateAwaitSuspendWrapper(Twine const &CoroName,
435435
llvm::FunctionType *LTy = CGM.getTypes().GetFunctionType(FI);
436436

437437
llvm::Function *Fn = llvm::Function::Create(
438-
LTy, llvm::GlobalValue::PrivateLinkage, FuncName, &CGM.getModule());
438+
LTy, llvm::GlobalValue::InternalLinkage, FuncName, &CGM.getModule());
439439

440440
Fn->addParamAttr(0, llvm::Attribute::AttrKind::NonNull);
441441
Fn->addParamAttr(0, llvm::Attribute::AttrKind::NoUndef);

clang/test/CodeGenCoroutines/coro-await.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ extern "C" void f0() {
100100
// CHECK: call i8 @llvm.coro.suspend(token %[[FINALSP_ID]], i1 true)
101101

102102
// Await suspend wrapper
103-
// CHECK: define{{.*}} @f0.__await_suspend_wrapper__await(ptr {{[^,]*}} %[[AWAITABLE_ARG:.+]], ptr {{[^,]*}} %[[FRAME_ARG:.+]])
103+
// CHECK: define internal {{.*}} @f0.__await_suspend_wrapper__await(ptr {{[^,]*}} %[[AWAITABLE_ARG:.+]], ptr {{[^,]*}} %[[FRAME_ARG:.+]])
104104
// CHECK: store ptr %[[AWAITABLE_ARG]], ptr %[[AWAITABLE_TMP:.+]],
105105
// CHECK: store ptr %[[FRAME_ARG]], ptr %[[FRAME_TMP:.+]],
106106
// CHECK: %[[AWAITABLE:.+]] = load ptr, ptr %[[AWAITABLE_TMP]]
@@ -162,7 +162,7 @@ extern "C" void f1(int) {
162162
// CHECK: call void @_ZN13suspend_maybe12await_resumeEv(ptr {{[^,]*}} %[[AWAITABLE]])
163163

164164
// Await suspend wrapper
165-
// CHECK: define {{.*}} i1 @f1.__await_suspend_wrapper__yield(ptr {{[^,]*}} %[[AWAITABLE_ARG:.+]], ptr {{[^,]*}} %[[FRAME_ARG:.+]])
165+
// CHECK: define internal {{.*}} i1 @f1.__await_suspend_wrapper__yield(ptr {{[^,]*}} %[[AWAITABLE_ARG:.+]], ptr {{[^,]*}} %[[FRAME_ARG:.+]])
166166
// CHECK: store ptr %[[AWAITABLE_ARG]], ptr %[[AWAITABLE_TMP:.+]],
167167
// CHECK: store ptr %[[FRAME_ARG]], ptr %[[FRAME_TMP:.+]],
168168
// CHECK: %[[AWAITABLE:.+]] = load ptr, ptr %[[AWAITABLE_TMP]]
@@ -379,7 +379,7 @@ extern "C" void TestTailcall() {
379379
// CHECK-NEXT: ]
380380

381381
// Await suspend wrapper
382-
// CHECK: define {{.*}} ptr @TestTailcall.__await_suspend_wrapper__await(ptr {{[^,]*}} %[[AWAITABLE_ARG:.+]], ptr {{[^,]*}} %[[FRAME_ARG:.+]])
382+
// CHECK: define internal {{.*}} ptr @TestTailcall.__await_suspend_wrapper__await(ptr {{[^,]*}} %[[AWAITABLE_ARG:.+]], ptr {{[^,]*}} %[[FRAME_ARG:.+]])
383383
// CHECK: store ptr %[[AWAITABLE_ARG]], ptr %[[AWAITABLE_TMP:.+]],
384384
// CHECK: store ptr %[[FRAME_ARG]], ptr %[[FRAME_TMP:.+]],
385385
// CHECK: %[[AWAITABLE:.+]] = load ptr, ptr %[[AWAITABLE_TMP]]

0 commit comments

Comments
 (0)