[clang-tools-extra] [clang-tidy] Avoid replacing match_results length() with empty() (PR #234905)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 30 06:55:02 PDT 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))),
+ hasCanonicalType(hasDeclaration(cxxRecordDecl(
+ matchers::matchesAnyListedRegexName(ExcludedLengthTypes))))));
+ const auto ExcludedLengthExprType = qualType(
+ anyOf(ExcludedLengthTypesMatcher, pointsTo(ExcludedLengthTypesMatcher),
+ references(ExcludedLengthTypesMatcher)));
----------------
vbvictor wrote:
Add tests with pointer/reference to match_results.
https://github.com/llvm/llvm-project/pull/234905
More information about the cfe-commits
mailing list