[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)

Jan Voung via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 11 08:41:23 PST 2025


================
@@ -78,6 +78,12 @@ static bool hasOptionalClassName(const CXXRecordDecl &RD) {
                             isFullyQualifiedNamespaceEqualTo(*N, "folly"));
   }
 
+  if (RD.getName() == "Optional_Base") {
----------------
jvoung wrote:

Great, glad you were thinking about it too =)

Hmm yes, I think there is a test like https://github.com/llvm/llvm-project/blob/8a9d9e48535f937ea6aa24060c2242c3a57660ac/clang/unittests/Analysis/FlowSensitive/UncheckedOptionalAccessModelTest.cpp#L2380

but I could be missing some cases... If you could try testing a bit more that would be great. It would be a little bit more of a simplification. Thank you!

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


More information about the cfe-commits mailing list