[clang-tools-extra] [clang-tidy] Fix false positive in bugprone-use-after-move for std::tie (PR #192895)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 19 22:35:36 PDT 2026
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 origin/main HEAD --extensions cpp -- clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp clang-tools-extra/test/clang-tidy/checkers/bugprone/use-after-move.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
index 92c4cc10c..04aa17fb4 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
@@ -138,10 +138,10 @@ makeReinitMatcher(const ValueDecl *MovedVariable,
// assignment writes back through the stored references.
binaryOperation(
hasOperatorName("="),
- hasLHS(callExpr(
- callee(functionDecl(hasName("::std::tie"))),
- hasAnyArgument(
- ignoringParenImpCasts(DeclRefMatcher))))),
+ hasLHS(
+ callExpr(callee(functionDecl(hasName("::std::tie"))),
+ hasAnyArgument(
+ ignoringParenImpCasts(DeclRefMatcher))))),
// Declaration. We treat this as a type of reinitialization
// too, so we don't need to treat it separately.
declStmt(hasDescendant(equalsNode(MovedVariable))),
``````````
</details>
https://github.com/llvm/llvm-project/pull/192895
More information about the cfe-commits
mailing list