[clang] [clang-tools-extra] [clang-tidy] `bugprone-unchecked-optional-access`: handle inheritance from `BloombergLP::bslstl::Optional_Base` to prevent false-positives for allocator-aware BDE types (PR #168863)

Valentyn Yukhymenko via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 20 04:08:31 PST 2025


================
@@ -1,44 +1,40 @@
 #ifndef LLVM_CLANG_TOOLS_EXTRA_TEST_CLANG_TIDY_CHECKERS_INPUTS_BDE_TYPES_OPTIONAL_H_
 #define LLVM_CLANG_TOOLS_EXTRA_TEST_CLANG_TIDY_CHECKERS_INPUTS_BDE_TYPES_OPTIONAL_H_
 
-/// Mock of `bsl::optional`.
+#include "../../std/types/optional.h"
+
 namespace bsl {
+  class string {};
+}
 
-// clang-format off
-template <typename T> struct remove_reference      { using type = T; };
----------------
BaLiKfromUA wrote:

I removed this code because it looks like it got copied from another mock which uses it for testing.

But there is no test for `bsl` type using this logic. 

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


More information about the cfe-commits mailing list