From 0d98bafc69f015df1bfa8466aff896c9714b4685 Mon Sep 17 00:00:00 2001 From: Samuel Benzaquen Date: Mon, 13 Oct 2014 18:17:11 +0000 Subject: [PATCH] Fix order of evaluation bug in DynTypedMatcher::constructVariadic(). 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ASTMatchers/ASTMatchersInternal.cpp b/lib/ASTMatchers/ASTMatchersInternal.cpp index c8e5852475..9d77cb6576 100644 --- a/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -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))); } -- 2.50.1