[clang-tools-extra] [clang-tidy] Fix performance-move-const-arg false negative in ternary… (PR #128402)

via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 17:21:06 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 5d501c6137976ff1f14f3b0e2e593fb9740d0146 848be2ccd25fd68b6a2d2037198184b08ff5d6e2 --extensions cpp -- clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp clang-tools-extra/test/clang-tidy/checkers/performance/move-const-arg.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
index 553c1d20cb..703ad162f9 100644
--- a/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/MoveConstArgCheck.cpp
@@ -63,16 +63,15 @@ void MoveConstArgCheck::registerMatchers(MatchFinder *Finder) {
   // Matches respective ParmVarDecl for a CallExpr or CXXConstructExpr.
   auto ArgumentWithParamMatcher = forEachArgumentWithParam(
       anyOf(MoveCallMatcher, TernaryWithMoveMatcher),
-      parmVarDecl(anyOf(hasType(ConstTypeParmMatcher),
-                                         hasType(RValueTypeParmMatcher)))
-                           .bind("invocation-parm"));
+      parmVarDecl(
+          anyOf(hasType(ConstTypeParmMatcher), hasType(RValueTypeParmMatcher)))
+          .bind("invocation-parm"));
   // Matches respective types of arguments for a CallExpr or CXXConstructExpr
   // and it works on calls through function pointers as well.
   auto ArgumentWithParamTypeMatcher = forEachArgumentWithParamType(
       anyOf(MoveCallMatcher, TernaryWithMoveMatcher),
       anyOf(ConstTypeParmMatcher, RValueTypeParmMatcher));
 
-
   Finder->addMatcher(
       invocation(anyOf(ArgumentWithParamMatcher, ArgumentWithParamTypeMatcher))
           .bind("receiving-expr"),

``````````

</details>


https://github.com/llvm/llvm-project/pull/128402


More information about the cfe-commits mailing list