[clang-tools-extra] [clang-tidy] Fix FP in readability-container-size-empty with compairing to unrelated type (PR #190535)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 13 10:47:27 PDT 2026


================
@@ -209,7 +209,7 @@ void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) {
   const auto WrongComparend =
       anyOf(stringLiteral(hasSize(0)),
             userDefinedLiteral(hasLiteral(stringLiteral(hasSize(0)))),
-            cxxConstructExpr(argumentCountIs(0)),
+            cxxConstructExpr(argumentCountIs(0), hasType(ValidContainer)),
----------------
vbvictor wrote:

Fixed with `equalsBoundNode`

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


More information about the cfe-commits mailing list