Author: Florian Mayer
Date: 2026-02-05T10:08:51-08:00
New Revision: 1214c96477867eb34e819184c756d899e9e027b4

URL: 
https://github.com/llvm/llvm-project/commit/1214c96477867eb34e819184c756d899e9e027b4
DIFF: 
https://github.com/llvm/llvm-project/commit/1214c96477867eb34e819184c756d899e9e027b4.diff

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



Reviewers: jvoung

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

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 5be4e38133744..575c8ccc1b723 100644
--- 
a/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
+++ 
b/clang/unittests/Analysis/FlowSensitive/UncheckedStatusOrAccessModelTestFixture.cpp
@@ -3960,6 +3960,23 @@ TEST_P(UncheckedStatusOrAccessModelTest, 
StatusPtrReference) {
   )cc");
 }
 
+TEST_P(UncheckedStatusOrAccessModelTest, PairIterator) {
+  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


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to