[PATCH] D103188: [clang-tidy] modernize-loop-convert: limit use of auto

Eugene Zelenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 1 06:48:29 PDT 2021


Eugene.Zelenko added a comment.

Frankly, I don't think that length-based criteria is reasonable one. Readability of code is much more important than line/file length.



================
Comment at: clang-tools-extra/clang-tidy/modernize/LoopConvertCheck.cpp:633
+  if (!Descriptor.ElemType.isNull()) {
+    auto FullType = Descriptor.ElemType.getUnqualifiedType();
+    if (Descriptor.ElemType->isFundamentalType() ||
----------------
Please don't use auto unless type is explicitly spelled in same statement or iterator.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst:163
 
+AutoTypeNameLength option
+------------------------
----------------
See other documentation file for syntax for options.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst:166
+
+If TypeName length is strictly above this threshold, `auto` will be used.
+
----------------
Please highlight TypeName (option) is single back-ticks and auto (language construct) with double back-ticks.


================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize-loop-convert.rst:168
+
+The default is 0, so `auto` will be used for all types except C++ fundamental types.
+
----------------
Please highlight 0 (option value) is single back-ticks and auto (language construct) with double back-ticks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103188



More information about the cfe-commits mailing list