[llvm-branch-commits] [clang] [FlowSensitive] [StatusOr] [9/N] Make sure all StatusOr are initialized (PR #163898)
Florian Mayer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Oct 17 16:54:43 PDT 2025
https://github.com/fmayer updated https://github.com/llvm/llvm-project/pull/163898
>From d2cabb899579b191507ab841063ae29d95cce74f Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Thu, 16 Oct 2025 17:29:13 -0700
Subject: [PATCH] leftover
Created using spr 1.3.7
---
...ncheckedStatusOrAccessModelTestFixture.cpp | 121 ------------------
1 file changed, 121 deletions(-)
diff --git a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
index ee700f706fc53..67c37e1e0f77f 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
@@ -3174,127 +3174,6 @@ TEST_P(UncheckedStatusOrAccessModelTest, ConstructStatusFromReference) {
)cc");
}
-/*
-
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorIndex) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
- class Foo {
- public:
- const STATUSOR_INT& operator[](size_t n) const;
- STATUSOR_INT& operator[](size_t n);
- };
-
- void target() {
- Foo foo;
- const auto sor1 = foo[0];
- const auto sor2 = foo[1];
- if (!sor1.ok() && !sor2.ok()) return;
- if (sor1.ok() && !sor2.ok()) {
- } else if (!sor1.ok() && sor2.ok()) {
- } else {
- sor1.value();
- sor2.value();
- }
- }
- )cc");
-}
-
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorAt) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
- class Foo {
- public:
- const STATUSOR_INT& at(size_t n) const;
- STATUSOR_INT& at(size_t n);
- };
-
- void target() {
- Foo foo;
- const auto sor1 = foo.at(0);
- const auto sor2 = foo.at(1);
- if (!sor1.ok() && !sor2.ok()) return;
- if (sor1.ok() && !sor2.ok()) {
- } else if (!sor1.ok() && sor2.ok()) {
- } else {
- sor1.value();
- sor2.value();
- }
- }
- )cc");
-}
-
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorIndexWithStatus) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
- class Foo {
- public:
- const STATUSOR_INT& operator[](size_t n) const;
- STATUSOR_INT& operator[](size_t n);
- };
- class Bar {
- public:
- const STATUS& operator[](size_t n) const;
- STATUS& operator[](size_t n);
- };
-
- void target() {
- Foo foo;
- const auto sor1 = foo[0];
- const auto sor2 = foo[1];
- Bar bar;
- const auto s1 = bar[0];
- const auto s2 = bar[1];
- if (!s1.ok() && !s2.ok()) return;
- if (s1.ok() && !s2.ok()) {
- } else if (!s1.ok() && s2.ok()) {
- } else {
- if (s1 != sor1.status() || s2 != sor2.status()) return;
- sor1.value();
- sor2.value();
- }
- }
- )cc");
-}
-TEST_P(UncheckedStatusOrAccessModelTest, OperatorAtWithStatus) {
- ExpectDiagnosticsFor(R"cc(
-#include "unchecked_statusor_access_test_defs.h"
-
- class Foo {
- public:
- const STATUSOR_INT& at(size_t n) const;
- STATUSOR_INT& at(size_t n);
- };
-
- class Bar {
- public:
- const STATUS& at(size_t n) const;
- STATUS& at(size_t n);
- };
-
- void target() {
- Foo foo;
- const auto sor1 = foo.at(0);
- const auto sor2 = foo.at(1);
- Bar bar;
- const auto s1 = bar.at(0);
- const auto s2 = bar.at(1);
- if (!s1.ok() && !s2.ok()) return;
- if (s1.ok() && !s2.ok()) {
- } else if (!s1.ok() && s2.ok()) {
- } else {
- if (s1 != sor1.status() || s2 != sor2.status()) return;
- sor1.value();
- sor2.value();
- }
- }
- )cc");
-}
- */
-
} // namespace
std::string
More information about the llvm-branch-commits
mailing list