[PATCH] D145581: [clang-tidy] In C++17, callee is guaranteed to be sequenced before arguments.

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Apr 23 12:54:48 PDT 2023


PiotrZSL added a comment.

First, re-base code, looks like there were some changes in this check, and now there are conflicts with this path.
Second I don't any more comments, for me this code looks fine, BUT I'm not familiar too much with this check.
Check history for this check, and maybe consider adding to review some other people who modify it recently.



================
Comment at: clang-tools-extra/clang-tidy/utils/ExprSequence.cpp:68-73
+  for (const Expr *Arg : Call->arguments()) {
+    if (isDescendantOrEqual(Descendant, Arg, Context))
+      return true;
+  }
+
+  return false;
----------------
NOTE: This looks like llvm::any_of 


================
Comment at: clang-tools-extra/clang-tidy/utils/ExprSequence.cpp:77-82
+  for (const Expr *Arg : Call->arguments()) {
+    if (Arg == TheStmt)
+      return true;
+  }
+
+  return false;
----------------
NOTE: this looks like llvm::any_of, or even something like contains/find


================
Comment at: clang-tools-extra/clang-tidy/utils/ExprSequence.cpp:161-165
+    if (const auto *call = dyn_cast<CallExpr>(Parent);
+        call && call->getCallee() == Before) {
+      if (isDescendantOfArgs(After, call, Context))
+        return true;
+    }
----------------
NOTE: probably you could move call outside if, and do rest with single if...


================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:167
+  <clang-tidy/checks/bugprone/use-after-move>`:
+  - Fixed handling for designated initializers.
+  - Fix: In C++17 and later, the callee of a function is guaranteed to be
----------------
NOTE: Probably better would be to keep similar template to rest of checks, just list fixes in sentences (or separated with ,), not as an list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145581



More information about the cfe-commits mailing list