[PATCH] D51949: [clang-tidy] new check 'readability-isolate-declaration'

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 28 11:27:59 PDT 2018


Eugene.Zelenko added a comment.

How about creating CERT alias?



================
Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:58
+  // number of transformations.
+  while (Indirections--) {
+    Start = findPreviousAnyTokenKind(Start, SM, LangOpts, tok::star, tok::amp);
----------------
It'll be better to compare with 0 explicitly.


================
Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:145
+  // future this should be relaxed and support various kinds of declarations.
+  VarDecl *FirstDecl = dyn_cast<VarDecl>(*DS->decl_begin());
+
----------------
auto could be used here.


================
Comment at: clang-tidy/readability/IsolateDeclarationCheck.cpp:198
+  SourceLocation DeclBegin = Start;
+  for (auto It = DS->decl_begin(), End = DS->decl_end(); It != End; ++It) {
+    VarDecl *CurrentDecl = dyn_cast<VarDecl>(*It);
----------------
Will be good idea to use range loop.


================
Comment at: docs/ReleaseNotes.rst:60
 
+- The 'readability-isolate-decl' check was renamed to :doc:`readability-isolate-declaration
+  <clang-tidy/checks/readability-isolate-declaration>`
----------------
Do we really need this entry?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D51949





More information about the cfe-commits mailing list