[PATCH] D145856: [clang-tidy] Let misc-const-correctness detect auto local variables that can be made const

Chris Thrasher via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Mar 11 18:15:31 PST 2023


ChrisThrasher created this revision.
ChrisThrasher added a reviewer: JonasToth.
Herald added subscribers: PiotrZSL, carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
ChrisThrasher requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145856

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


Index: clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp
+++ clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp
@@ -73,9 +73,9 @@
       hasType(referenceType(pointee(hasCanonicalType(templateTypeParmType())))),
       hasType(referenceType(pointee(substTemplateTypeParmType()))));
 
-  const auto AutoTemplateType = varDecl(
-      anyOf(hasType(autoType()), hasType(referenceType(pointee(autoType()))),
-            hasType(pointerType(pointee(autoType())))));
+  const auto AutoTemplateType =
+      varDecl(anyOf(hasType(referenceType(pointee(autoType()))),
+                    hasType(pointerType(pointee(autoType())))));
 
   const auto FunctionPointerRef =
       hasType(hasCanonicalType(referenceType(pointee(functionType()))));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145856.504397.patch
Type: text/x-patch
Size: 890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230312/35fccacf/attachment.bin>


More information about the cfe-commits mailing list