[PATCH] D53771: [clang-tidy] Avoid C arrays check
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 4 05:05:50 PST 2018
lebedev.ri marked 4 inline comments as done.
lebedev.ri added a comment.
(only comments, patch to follow)
================
Comment at: clang-tidy/cppcoreguidelines/CppCoreGuidelinesTidyModule.cpp:84
"cppcoreguidelines-c-copy-assignment-signature");
+ CheckFactories.registerCheck<modernize::AvoidCArraysCheck>(
+ "cppcoreguidelines-avoid-c-arrays");
----------------
JonasToth wrote:
> lebedev.ri wrote:
> > JonasToth wrote:
> > > please conserve the alphabetical order here
> > Sorted all the `CheckFactories.registerCheck<>();` lines.
> the `avoid-*` checks seem to be displaced now.
How it should be sorted? By the new check name? Or the internal class name?
If it is not the latter, then sorting is really problematic as it can't be automatized.
================
Comment at: test/clang-tidy/modernize-avoid-c-arrays.cpp:10-11
+void foo() {
+ int c[b[0]];
+ // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: do not declare C-style arrays, use std::array<> instead
+}
----------------
This is VLA.
Note that VLA are C99, they (thankfully!) don't exist in C++ standard at all.
Looks like `variableArrayType()` should single-out this, so let's see..
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D53771
More information about the cfe-commits
mailing list