[PATCH] D117090: [clang-tidy] Fix `readability-non-const-parameter` for parameter referenced by an lvalue

gehry via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 14 03:38:27 PST 2022


Sockke added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/readability/NonConstParameterCheck.cpp:86-99
+      // Data passed by nonconst reference should not be made const.
+      unsigned ArgNr = 0U;
+      if (const auto *CD = CE->getConstructor()) {
+        for (const auto *Par : CD->parameters()) {
+          if (ArgNr >= CE->getNumArgs())
+            break;
+          const Expr *Arg = CE->getArg(ArgNr++);
----------------
MTC wrote:
> `86~99` is pretty close to `64~81`, could you please refactor it?
> `86~99` is pretty close to `64~81`, could you please refactor it?

`FunctionDecl` and `CXXConstructDecl` have different methods with the same name.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117090



More information about the cfe-commits mailing list