Skip to content

Commit 8352c50

Browse files
committed
fix with review
1 parent c2defc6 commit 8352c50

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,14 @@ void ConstCorrectnessCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
8181
}
8282

8383
void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
84-
const auto ConstType = hasType(
85-
qualType(isConstQualified(),
86-
// pointee check will check the const pointer and const array
87-
unless(pointerType()), unless(arrayType())));
84+
const auto ConstType =
85+
hasType(qualType(isConstQualified(),
86+
// pointee check will check the constness of pointer
87+
unless(pointerType())));
8888

8989
const auto ConstReference = hasType(references(isConstQualified()));
9090
const auto RValueReference = hasType(
9191
referenceType(anyOf(rValueReferenceType(), unless(isSpelledAsLValue()))));
92-
const auto ConstArrayType =
93-
hasType(arrayType(hasElementType(isConstQualified())));
9492

9593
const auto TemplateType = anyOf(
9694
hasType(hasCanonicalType(templateTypeParmType())),
@@ -117,7 +115,7 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
117115
// Example: `int i = 10` would match `int i`.
118116
const auto LocalValDecl = varDecl(
119117
isLocal(), hasInitializer(anything()),
120-
unless(anyOf(ConstType, ConstReference, ConstArrayType, TemplateType,
118+
unless(anyOf(ConstType, ConstReference, TemplateType,
121119
hasInitializer(isInstantiationDependent()), AutoTemplateType,
122120
RValueReference, FunctionPointerRef,
123121
hasType(cxxRecordDecl(isLambda())), isImplicit(),

0 commit comments

Comments
 (0)