r219624 - Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
Samuel Benzaquen
sbenza at google.com
Mon Oct 13 11:17:11 PDT 2014
Author: sbenza
Date: Mon Oct 13 13:17:11 2014
New Revision: 219624
URL: http://llvm.org/viewvc/llvm-project?rev=219624&view=rev
Log:
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.
Modified:
cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
Modified: cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp?rev=219624&r1=219623&r2=219624&view=diff
==============================================================================
--- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Mon Oct 13 13:17:11 2014
@@ -99,8 +99,8 @@ DynTypedMatcher DynTypedMatcher::constru
// 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)));
}
More information about the cfe-commits
mailing list