[llvm-branch-commits] [clang] [FlowSensitive] [StatusOr] add test involving co_return (PR #182610)
Florian Mayer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 20 14:51:48 PST 2026
https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/182610
>From 2f7df5cd2d64f24e33814ddddfc9cab56c909167 Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Fri, 20 Feb 2026 14:44:52 -0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
...ncheckedStatusOrAccessModelTestFixture.cpp | 30 +++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
index 5d4558f37bcf6..f2df3b9fc1094 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
@@ -4516,6 +4516,36 @@ TEST_P(UncheckedStatusOrAccessModelTest, NestedStatusOrInOptional) {
)cc");
}
+TEST_P(UncheckedStatusOrAccessModelTest, CoroutineCoReturn) {
+ ExpectDiagnosticsFor(R"cc(
+#include "unchecked_statusor_access_test_defs.h"
+#include "std_coroutine.h"
+
+ template<typename T>
+ struct Task {
+ struct promise_type {
+ Task get_return_object();
+ std::suspend_never initial_suspend() noexcept;
+ std::suspend_always final_suspend() noexcept;
+ void return_value(T v);
+ void unhandled_exception();
+ };
+ bool await_ready() const noexcept;
+ T await_resume() noexcept;
+ void await_suspend(std::coroutine_handle<> handle) noexcept;
+ };
+
+ Task<STATUSOR_INT> target(STATUSOR_INT sor) {
+ if (sor.ok()) {
+ sor.value();
+ } else {
+ sor.value(); // [[unsafe]]
+ }
+ co_return sor;
+ }
+ )cc");
+}
+
} // namespace
std::string
More information about the llvm-branch-commits
mailing list