[PATCH] D98497: [ASTMatchers] Don't forward matchers in MapAnyOf

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 12 05:52:11 PST 2021


njames93 created this revision.
njames93 added reviewers: aaron.ballman, steveire, klimek.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98497

Files:
  clang/include/clang/ASTMatchers/ASTMatchersInternal.h


Index: clang/include/clang/ASTMatchers/ASTMatchersInternal.h
===================================================================
--- clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -1386,8 +1386,7 @@
             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>...>())));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98497.330219.patch
Type: text/x-patch
Size: 692 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210312/c08f0e5e/attachment.bin>


More information about the cfe-commits mailing list