@@ -25,7 +25,8 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) {
25
25
hasParent (expr (hasParent (cxxConstructExpr (hasParent (returnStmt ())))));
26
26
27
27
auto outermostExpr = expr (unless (hasParent (expr ())));
28
- auto leafStatement = stmt (outermostExpr, unless (hasDescendant (outermostExpr)));
28
+ auto leafStatement =
29
+ stmt (outermostExpr, unless (hasDescendant (outermostExpr)));
29
30
30
31
Finder->addMatcher (
31
32
declRefExpr (
@@ -49,7 +50,7 @@ void LostStdMoveCheck::registerMatchers(MatchFinder *Finder) {
49
50
unless (hasDeclaration (
50
51
varDecl (hasType (qualType (lValueReferenceType ()))))),
51
52
52
- hasAncestor (leafStatement.bind (" leaf_statement" )),
53
+ hasAncestor (leafStatement.bind (" leaf_statement" )),
53
54
54
55
hasDeclaration (
55
56
varDecl (hasAncestor (functionDecl ().bind (" func" ))).bind (" decl" )),
@@ -88,7 +89,8 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) {
88
89
const auto *MatchedFunc = Result.Nodes .getNodeAs <FunctionDecl>(" func" );
89
90
const auto *MatchedUse = Result.Nodes .getNodeAs <Expr>(" use" );
90
91
const auto *MatchedUseCall = Result.Nodes .getNodeAs <CallExpr>(" use_parent" );
91
- const auto *MatchedLeafStatement = Result.Nodes .getNodeAs <Stmt>(" leaf_statement" );
92
+ const auto *MatchedLeafStatement =
93
+ Result.Nodes .getNodeAs <Stmt>(" leaf_statement" );
92
94
93
95
if (MatchedUseCall)
94
96
return ;
@@ -105,7 +107,9 @@ void LostStdMoveCheck::check(const MatchFinder::MatchResult &Result) {
105
107
106
108
// Calculate X usage count in the statement
107
109
llvm::SmallPtrSet<const DeclRefExpr *, 16 > DeclRefs;
108
- auto Matches = match (findAll (declRefExpr (to (varDecl (equalsNode (MatchedDecl)))).bind (" ref" )), *MatchedLeafStatement, *Result.Context );
110
+ auto Matches = match (
111
+ findAll (declRefExpr (to (varDecl (equalsNode (MatchedDecl)))).bind (" ref" )),
112
+ *MatchedLeafStatement, *Result.Context );
109
113
extractNodesByIdTo (Matches, " ref" , DeclRefs);
110
114
if (DeclRefs.size () > 1 ) {
111
115
// Unspecified order of evaluation, e.g. f(x, x)
0 commit comments