[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
Wed Dec 10 12:48:52 PST 2025


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

Do you know if the check earlier "isFullyQualifiedNamespaceEqualTo(*N, "bsl");" is still needed (line 70), if in one case the methods are inherited from std::optional, and the other case inherited from  the Optional_Base ?

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


More information about the cfe-commits mailing list