[PATCH] D145138: [clang-tidy] Implement FixIts for C arrays

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 2 07:22:40 PST 2023


Eugene.Zelenko added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp:94
+
+  auto StartOfFile = SM.getLocForStartOfFile(SM.getFileID(Location));
+  while (Location != StartOfFile) {
----------------
Please do not use `auto` unless type is explicitly stated in same statement or iterator.


================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp:498
+                return false;
+              const CXXConstructExpr *ConstructExpr =
+                  dyn_cast<CXXConstructExpr>(SpelledExpr);
----------------
`auto` could be used here.


================
Comment at: clang-tools-extra/clang-tidy/modernize/AvoidCArraysCheck.cpp:588
+    : ClangTidyCheck(Name, Context),
+      IncludeInserter(Options.getLocalOrGlobal("IncludeStyle",
+                                               utils::IncludeSorter::IS_LLVM),
----------------
Should be global option, because it's used in other checks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/avoid-c-arrays.rst:71
 can be either ``char* argv[]`` or ``char** argv``, but cannot be
 ``std::array<>``.
----------------
Missing documentation for `IncludeStyle` option if it'll remain local.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145138/new/

https://reviews.llvm.org/D145138



More information about the cfe-commits mailing list