[clang] 1d3ce0c - [NFC] [FlowSensitive] [StatusOr] precommit test for another FP

Florian Mayer via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 5 10:21:31 PST 2026


Author: Florian Mayer
Date: 2026-02-05T10:20:59-08:00
New Revision: 1d3ce0cfff791c48ba2b9b8754c2a8b46539acb1

URL: https://github.com/llvm/llvm-project/commit/1d3ce0cfff791c48ba2b9b8754c2a8b46539acb1
DIFF: https://github.com/llvm/llvm-project/commit/1d3ce0cfff791c48ba2b9b8754c2a8b46539acb1.diff

LOG: [NFC] [FlowSensitive] [StatusOr] precommit test for another FP



Pull Request: https://github.com/llvm/llvm-project/pull/179806

Added: 
    

Modified: 
    clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
index 575c8ccc1b723..3daf4473b0b81 100644
--- a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
+++ b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
@@ -3977,6 +3977,23 @@ TEST_P(UncheckedStatusOrAccessModelTest, PairIterator) {
 )cc");
 }
 
+TEST_P(UncheckedStatusOrAccessModelTest, PairIteratorRef) {
+  ExpectDiagnosticsFor(R"cc(
+#include "unchecked_statusor_access_test_defs.h"
+
+    class iterator {
+     public:
+      const std::pair<int, absl::StatusOr<int>>& operator*() const;
+    };
+    void target() {
+      if (auto it = Make<iterator>(); (*it).second.ok()) {
+        // This is a false positive. Fix and remove the unsafe.
+        (*it).second.value();  // [[unsafe]]
+      }
+    }
+)cc");
+}
+
 } // namespace
 
 std::string


        


More information about the cfe-commits mailing list