[clang] 6f1b2e4 - [NFC] Correct the test code in pr65018
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 28 20:32:50 PDT 2023
Author: Chuanqi Xu
Date: 2023-08-29T11:30:47+08:00
New Revision: 6f1b2e4e97e2d6e8f19a9a6d64547b027617fa39
URL: https://github.com/llvm/llvm-project/commit/6f1b2e4e97e2d6e8f19a9a6d64547b027617fa39
DIFF: https://github.com/llvm/llvm-project/commit/6f1b2e4e97e2d6e8f19a9a6d64547b027617fa39.diff
LOG: [NFC] Correct the test code in pr65018
The test code in pr65018 is actually incorrect since the optimizier are
free to optimize the whole coroutine body away. This patch corrected
this.
Added:
Modified:
clang/test/CodeGenCoroutines/pr65018.cpp
Removed:
################################################################################
diff --git a/clang/test/CodeGenCoroutines/pr65018.cpp b/clang/test/CodeGenCoroutines/pr65018.cpp
index 03d123e1e7e2f7..2fdfe684b592fb 100644
--- a/clang/test/CodeGenCoroutines/pr65018.cpp
+++ b/clang/test/CodeGenCoroutines/pr65018.cpp
@@ -17,13 +17,20 @@ struct MyTask {
// A lazy promise with an await_transform method that supports awaiting
// integer references using the Awaiter struct above.
struct promise_type {
- MyTask get_return_object() { return {}; }
+ MyTask get_return_object() {
+ return MyTask{
+ std::coroutine_handle<promise_type>::from_promise(*this),
+ };
+ }
+
std::suspend_always initial_suspend() { return {}; }
std::suspend_always final_suspend() noexcept { return {}; }
void unhandled_exception();
auto await_transform(const int& x) { return Awaiter{x}; }
};
+
+ std::coroutine_handle<> h;
};
// A global array of integers.
More information about the cfe-commits
mailing list