[clang] 74c270f - [ASTMatchers] Don't forward matchers in MapAnyOf
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 15 07:17:02 PDT 2021
Author: Nathan James
Date: 2021-03-15T14:16:52Z
New Revision: 74c270f33eb16d336b4ab834e18b27f8efcbabe8
URL: https://github.com/llvm/llvm-project/commit/74c270f33eb16d336b4ab834e18b27f8efcbabe8
DIFF: https://github.com/llvm/llvm-project/commit/74c270f33eb16d336b4ab834e18b27f8efcbabe8.diff
LOG: [ASTMatchers] Don't forward matchers in MapAnyOf
Forwarding these means that if an r-value reference is passed, the matcher will be moved. However it appears this happens for each mapped node matcher, resulting in use-after-move issues.
Reviewed By: steveire
Differential Revision: https://reviews.llvm.org/D98497
Added:
Modified:
clang/include/clang/ASTMatchers/ASTMatchersInternal.h
Removed:
################################################################################
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 19b8941746dd..53b37b338a55 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -1386,8 +1386,7 @@ struct MapAnyOfMatcherImpl {
internal::DynTypedMatcher::VO_AnyOf},
applyMatcher(
[&](auto... Matcher) {
- return std::make_tuple(Matcher(
- std::forward<decltype(InnerMatcher)>(InnerMatcher)...)...);
+ return std::make_tuple(Matcher(InnerMatcher...)...);
},
std::tuple<
VariadicDynCastAllOfMatcher<CladeType, MatcherTypes>...>())));
More information about the cfe-commits
mailing list