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 a184e616e..2e014451e 100644
--- a/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
@@ -37,7 +37,6 @@ static std::optional<StringRef> getStringLiteral(const Expr
*E) {
return std::nullopt;
}
-
namespace {
AST_MATCHER_P(Expr, hasParentIgnoringParenImpCasts,
ast_matchers::internal::Matcher<Expr>, InnerMatcher) {
@@ -57,7 +56,7 @@ AST_MATCHER_P(Expr, hasParentIgnoringParenImpCasts,
// Methods can be decorated with [[clang::annotate]] to specify it has
// a user-defined behavior when called on a moved-from.
AST_MATCHER(CXXMethodDecl, hasSpecifiedAfterMoveAnnotation) {
- for(const AnnotateAttr *Attr : Node.specific_attrs<AnnotateAttr>()) {
+ for (const AnnotateAttr *Attr : Node.specific_attrs<AnnotateAttr>()) {
if (Attr->getAnnotation() != "clang-tidy")
continue;
@@ -71,10 +70,9 @@ AST_MATCHER(CXXMethodDecl, hasSpecifiedAfterMoveAnnotation) {
if (Plugin && Annotation && *Plugin == "bugprone-use-after-move" &&
*Annotation == "specified_after_move")
return true;
- }
- return false;
- }
-
+ }
+ return false;
+}
/// Contains information about a use-after-move.
struct UseAfterMove {
@@ -461,7 +459,8 @@ void UseAfterMoveFinder::getDeclRefs(
hasDeclaration(equalsNode(MovedVariable)),
unless(inDecltypeOrTemplateArg()),
unless(hasParentIgnoringParenImpCasts(memberExpr(hasDeclaration(
- anyOf(cxxDestructorDecl(),
cxxMethodDecl(hasSpecifiedAfterMoveAnnotation())))))),
+ anyOf(cxxDestructorDecl(),
+ cxxMethodDecl(hasSpecifiedAfterMoveAnnotation())))))),
optionally(hasParentIgnoringParenImpCasts(
memberExpr().bind("member-expr"))))
.bind("declref");
``````````
</details>
https://github.com/llvm/llvm-project/pull/216121
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits