[clang-tools-extra] [clang-tidy] Avoid replacing match_results length() with empty() (PR #234905)

via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 1 06:14:51 PST 2026


================
@@ -168,6 +172,15 @@ void ContainerSizeEmptyCheck::registerMatchers(MatchFinder *Finder) {
   const auto ValidContainer = qualType(
       anyOf(ValidContainerNonTemplateType, ValidContainerTemplateType));
 
+  const auto ExcludedLengthTypesMatcher = qualType(
+      anyOf(hasDeclaration(cxxRecordDecl(
+                matchers::matchesAnyListedRegexName(ExcludedLengthTypes))),
----------------
MitraGulla wrote:

The first hasDeclaration(..) is not needed , initially i added it for explicitly matching direct `std::match_results` types but the canonical type matcher is already covering direct types and aliases and typedefs so that first one is not needed, i have removed it and added the tests 

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


More information about the cfe-commits mailing list