[PATCH] D56160: [clang-tidy] modernize-use-trailing-return-type check

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 28 05:11:31 PST 2019


JonasToth added a comment.

>From my side only the nits are left.



================
Comment at: clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:94
+  bool VisitDeclRefExpr(DeclRefExpr *S) {
+    const DeclarationName Name = S->getNameInfo().getName();
+    if (!S->getQualifierLoc() && Name.isIdentifier() &&
----------------
Nit: `const` is only used for references or pointers.


================
Comment at: clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:154
+    }
+
+    break;
----------------
Nit: I think this and the next empty line could be ellided. They do not add a lot of value and we try to keep the code dense.


================
Comment at: clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp:241
+        !ExtendedLeft) {
+      for (int J = static_cast<int>(I) - 1; J >= 0 && IsCV(Tokens[J]); J--)
+        ReturnTypeRange.setBegin(Tokens[J].getLocation());
----------------
integer bug for big `Tokens.size()`. Please add an `assert(I <= size_t(std::numeric_limits<int>::max()) && "Integer overflow detected")` or the like.
Optimally `gsl::narrow<>()` could be used, which we do not have in LLVM.


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

https://reviews.llvm.org/D56160





More information about the cfe-commits mailing list