[llvm-branch-commits] [FlowSensitive] [StatusOr] [15/15] Support references to Status(Or)* (PR #170951)

Florian Mayer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 10 10:53:01 PST 2025


================
@@ -3840,6 +3840,56 @@ TEST_P(UncheckedStatusOrAccessModelTest, NestedStatusOrInStatusOrStruct) {
       )cc");
 }
 
+TEST_P(UncheckedStatusOrAccessModelTest, StatusOrPtrReference) {
+  ExpectDiagnosticsFor(R"cc(
+#include "unchecked_statusor_access_test_defs.h"
+
+    const STATUSOR_INT* foo();
+
+    void target() {
+      const auto& sor = foo();
+      if (sor->ok()) sor->value();
+    }
+  )cc");
+
+  ExpectDiagnosticsFor(R"cc(
+#include "unchecked_statusor_access_test_defs.h"
+
+    using StatusOrPtr = const STATUSOR_INT*;
+    StatusOrPtr foo();
+
+    void target() {
+      const auto& sor = foo();
----------------
fmayer wrote:

yes. this PR is about references to Status(Or) pointers. Maybe I should make the commit message clear

https://github.com/llvm/llvm-project/pull/170951


More information about the llvm-branch-commits mailing list