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

liushuai wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 00:44:32 PST 2022


MTC 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++);
----------------
`86~99` is pretty close to `64~81`, could you please refactor it?


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