[clang] [clang-tools-extra] [clang-tidy] `bugprone-unchecked-optional-access`: Add support for GTest asserts like `ASSERT_TRUE` and `ASSERT_FALSE` (PR #186363)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 18 04:06:32 PDT 2026


================
@@ -115,6 +115,18 @@ static bool isSupportedOptionalType(QualType Ty) {
   return Optional != nullptr;
 }
 
+static bool isAssertionResultType(QualType Type) {
+  if (Type.isNull())
+    return false;
+
+  if (auto *RD = Type->getAsRecordDecl())
----------------
vbvictor wrote:

nit: it could be
`auto *RD = Type->getAsRecordDecl(); RD && RD->getName() == "AssertionResult"` to reduce nesting

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


More information about the cfe-commits mailing list