@@ -89,6 +89,8 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
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 ())));
9294
9395 const auto TemplateType = anyOf (
9496 hasType (hasCanonicalType (templateTypeParmType ())),
@@ -115,7 +117,7 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
115117 // Example: `int i = 10` would match `int i`.
116118 const auto LocalValDecl = varDecl (
117119 isLocal (), hasInitializer (anything ()),
118- unless (anyOf (ConstType, ConstReference, TemplateType,
120+ unless (anyOf (ConstType, ConstReference, ConstArrayType, TemplateType,
119121 hasInitializer (isInstantiationDependent ()), AutoTemplateType,
120122 RValueReference, FunctionPointerRef,
121123 hasType (cxxRecordDecl (isLambda ())), isImplicit (),
@@ -161,6 +163,7 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
161163
162164 VariableCategory VC = VariableCategory::Value;
163165 const QualType VT = Variable->getType ();
166+ VT->dump ();
164167 if (VT->isReferenceType ()) {
165168 VC = VariableCategory::Reference;
166169 } else if (VT->isPointerType ()) {
@@ -169,6 +172,7 @@ void ConstCorrectnessCheck::check(const MatchFinder::MatchResult &Result) {
169172 if (ArrayT->getElementType ()->isPointerType ())
170173 VC = VariableCategory::Pointer;
171174 }
175+ llvm::errs () << (int )VC << " \n " ;
172176
173177 auto CheckValue = [&]() {
174178 // The scope is only registered if the analysis shall be run.
0 commit comments