[clang-tools-extra] [clang-tidy][NFC] Enable `bugprone-unchecked-optional-access` in `clang-tidy` config and fix warnings (PR #170004)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 17 02:40:41 PST 2025


================
@@ -304,6 +304,9 @@ static bool isQualificationConvertiblePointer(QualType From, QualType To,
            "From pointer or array has no pointee or element!");
     assert(ToPointeeOrElem && "To pointer or array has no pointee or element!");
 
+    if (!FromPointeeOrElem || !ToPointeeOrElem)
+      return false;
+
----------------
vbvictor wrote:

If we aren't enabling this check in CI, we better use just `assert` without any `if` statements.

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


More information about the cfe-commits mailing list