]> granicus.if.org Git - clang/commitdiff
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
authorSamuel Benzaquen <sbenza@google.com>
Mon, 13 Oct 2014 18:17:11 +0000 (18:17 +0000)
committerSamuel Benzaquen <sbenza@google.com>
Mon, 13 Oct 2014 18:17:11 +0000 (18:17 +0000)
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
If it evaluates right-to-left, the vector gets moved before we read the
kind from it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219624 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ASTMatchers/ASTMatchersInternal.cpp

index c8e5852475c2365a54da46f128ce4f4a4aca2087..9d77cb65767f75b1b9ffb103c1bfca2b70d5aae7 100644 (file)
@@ -99,8 +99,8 @@ DynTypedMatcher DynTypedMatcher::constructVariadic(
   // The different operators might deal differently with a mismatch.
   // Make it the same as SupportedKind, since that is the broadest type we are
   // allowed to accept.
-  return DynTypedMatcher(InnerMatchers[0].SupportedKind,
-                         InnerMatchers[0].SupportedKind,
+  auto SupportedKind = InnerMatchers[0].SupportedKind;
+  return DynTypedMatcher(SupportedKind, SupportedKind,
                          new VariadicMatcher(Func, std::move(InnerMatchers)));
 }