[clang] [clang-tidy] [dataflow] Cache reference accessors for `bugprone-unchecked-optional-access` (PR #128437)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 25 07:29:20 PST 2025


================
@@ -3863,6 +3863,192 @@ TEST_P(UncheckedOptionalAccessTest, ConstBoolAccessorWithModInBetween) {
   )cc");
 }
 
+TEST_P(UncheckedOptionalAccessTest,
+       ConstRefAccessorToOptionalViaConstRefAccessorToHoldingObject) {
+  ExpectDiagnosticsFor(R"cc(
+    #include "unchecked_optional_access_test.h"
+
+    class A {
----------------
jvoung wrote:

Maybe simplify these a little bit (`struct` then don't need the public/private)

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


More information about the cfe-commits mailing list