forked from OSchip/llvm-project
ASTMatchers: Replace some copies of the bound nodes tree builder with moves.
But don't move if all we do is clearing the thing. The move method is too large to be inlined and performs a ton of unnecessary checking when the RHS is empty. No functionality change. llvm-svn: 216723
This commit is contained in:
parent
90d6101410
commit
d9c9162bb9
|
@ -2285,7 +2285,7 @@ AST_POLYMORPHIC_MATCHER_P(hasAnyArgument, AST_POLYMORPHIC_SUPPORTED_TYPES_2(
|
|||
BoundNodesTreeBuilder Result(*Builder);
|
||||
if (InnerMatcher.matches(*Node.getArg(I)->IgnoreParenImpCasts(), Finder,
|
||||
&Result)) {
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3614,7 +3614,7 @@ AST_MATCHER_P(SwitchStmt, forEachSwitchCase, internal::Matcher<SwitchCase>,
|
|||
Result.addMatch(CaseBuilder);
|
||||
}
|
||||
}
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return Matched;
|
||||
}
|
||||
|
||||
|
@ -3637,7 +3637,7 @@ AST_MATCHER_P(CXXConstructorDecl, forEachConstructorInitializer,
|
|||
Result.addMatch(InitBuilder);
|
||||
}
|
||||
}
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return Matched;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ public:
|
|||
// Delete all bindings when a matcher does not match.
|
||||
// This prevents unexpected exposure of bound nodes in unmatches
|
||||
// branches of the match tree.
|
||||
*Builder = BoundNodesTreeBuilder();
|
||||
Builder->removeBindings([](const BoundNodesMap &) { return true; });
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ bool matchesFirstInRange(const MatcherT &Matcher, IteratorT Start,
|
|||
for (IteratorT I = Start; I != End; ++I) {
|
||||
BoundNodesTreeBuilder Result(*Builder);
|
||||
if (Matcher.matches(*I, Finder, &Result)) {
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -506,7 +506,7 @@ bool matchesFirstInPointerRange(const MatcherT &Matcher, IteratorT Start,
|
|||
for (IteratorT I = Start; I != End; ++I) {
|
||||
BoundNodesTreeBuilder Result(*Builder);
|
||||
if (Matcher.matches(**I, Finder, &Result)) {
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ bool EachOfVariadicOperator(const ast_type_traits::DynTypedNode DynNode,
|
|||
Result.addMatch(BuilderInner);
|
||||
}
|
||||
}
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return Matched;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ bool AnyOfVariadicOperator(const ast_type_traits::DynTypedNode DynNode,
|
|||
for (size_t i = 0, e = InnerMatchers.size(); i != e; ++i) {
|
||||
BoundNodesTreeBuilder Result = *Builder;
|
||||
if (InnerMatchers[i].matches(DynNode, Finder, &Result)) {
|
||||
*Builder = Result;
|
||||
*Builder = std::move(Result);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue