<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 7, 2014 at 3:06 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On Mon, Jul 7, 2014 at 8:55 AM, Manuel Klimek <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
> Author: klimek<br>
> Date: Mon Jul 7 07:55:16 2014<br>
> New Revision: 212452<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212452&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=212452&view=rev</a><br>
> Log:<br>
> Increase argument limit of anyOf, allOf and eachOf from 5 to 9.<br>
<br>
</div>Can we simply use truly variadic templates now that we're using C++11 features?<br></blockquote><div><br></div><div>See</div><div><a href="http://llvm.org/docs/CodingStandards.html#supported-c-11-language-and-library-features">http://llvm.org/docs/CodingStandards.html#supported-c-11-language-and-library-features</a><br>
</div><div><br></div><div>Variadic templates are not supported by VS 2012.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<span class=""><font color="#888888"><br>
~Aaron<br>
</font></span><div class=""><div class="h5"><br>
><br>
> Patch by Alexey Sokolov.<br>
><br>
> Modified:<br>
> cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h<br>
><br>
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=212452&r1=212451&r2=212452&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=212452&r1=212451&r2=212452&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)<br>
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Mon Jul 7 07:55:16 2014<br>
> @@ -1126,16 +1126,25 @@ struct VariadicOperatorNoArg {};<br>
> template <typename P1, typename P2 = VariadicOperatorNoArg,<br>
> typename P3 = VariadicOperatorNoArg,<br>
> typename P4 = VariadicOperatorNoArg,<br>
> - typename P5 = VariadicOperatorNoArg><br>
> + typename P5 = VariadicOperatorNoArg,<br>
> + typename P6 = VariadicOperatorNoArg,<br>
> + typename P7 = VariadicOperatorNoArg,<br>
> + typename P8 = VariadicOperatorNoArg,<br>
> + typename P9 = VariadicOperatorNoArg><br>
> class VariadicOperatorMatcher {<br>
> public:<br>
> VariadicOperatorMatcher(VariadicOperatorFunction Func, const P1 &Param1,<br>
> const P2 &Param2 = VariadicOperatorNoArg(),<br>
> const P3 &Param3 = VariadicOperatorNoArg(),<br>
> const P4 &Param4 = VariadicOperatorNoArg(),<br>
> - const P5 &Param5 = VariadicOperatorNoArg())<br>
> + const P5 &Param5 = VariadicOperatorNoArg(),<br>
> + const P6 &Param6 = VariadicOperatorNoArg(),<br>
> + const P7 &Param7 = VariadicOperatorNoArg(),<br>
> + const P8 &Param8 = VariadicOperatorNoArg(),<br>
> + const P9 &Param9 = VariadicOperatorNoArg())<br>
> : Func(Func), Param1(Param1), Param2(Param2), Param3(Param3),<br>
> - Param4(Param4), Param5(Param5) {}<br>
> + Param4(Param4), Param5(Param5), Param6(Param6), Param7(Param7),<br>
> + Param8(Param8), Param9(Param9) {}<br>
><br>
> template <typename T> operator Matcher<T>() const {<br>
> std::vector<DynTypedMatcher> Matchers;<br>
> @@ -1144,6 +1153,10 @@ public:<br>
> addMatcher<T>(Param3, Matchers);<br>
> addMatcher<T>(Param4, Matchers);<br>
> addMatcher<T>(Param5, Matchers);<br>
> + addMatcher<T>(Param6, Matchers);<br>
> + addMatcher<T>(Param7, Matchers);<br>
> + addMatcher<T>(Param8, Matchers);<br>
> + addMatcher<T>(Param9, Matchers);<br>
> return Matcher<T>(<br>
> new VariadicOperatorMatcherInterface<T>(Func, std::move(Matchers)));<br>
> }<br>
> @@ -1166,12 +1179,16 @@ private:<br>
> const P3 Param3;<br>
> const P4 Param4;<br>
> const P5 Param5;<br>
> + const P6 Param6;<br>
> + const P7 Param7;<br>
> + const P8 Param8;<br>
> + const P9 Param9;<br>
> };<br>
><br>
> /// \brief Overloaded function object to generate VariadicOperatorMatcher<br>
> /// objects from arbitrary matchers.<br>
> ///<br>
> -/// It supports 1-5 argument overloaded operator(). More can be added if needed.<br>
> +/// It supports 1-9 argument overloaded operator(). More can be added if needed.<br>
> template <unsigned MinCount, unsigned MaxCount><br>
> struct VariadicOperatorMatcherFunc {<br>
> VariadicOperatorFunction Func;<br>
> @@ -1208,6 +1225,43 @@ struct VariadicOperatorMatcherFunc {<br>
> return VariadicOperatorMatcher<M1, M2, M3, M4, M5>(Func, P1, P2, P3, P4,<br>
> P5);<br>
> }<br>
> + template <typename M1, typename M2, typename M3, typename M4, typename M5,<br>
> + typename M6><br>
> + typename EnableIfValidArity<<br>
> + 6, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6> >::type<br>
> + operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,<br>
> + const M5 &P5, const M6 &P6) const {<br>
> + return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6>(<br>
> + Func, P1, P2, P3, P4, P5, P6);<br>
> + }<br>
> + template <typename M1, typename M2, typename M3, typename M4, typename M5,<br>
> + typename M6, typename M7><br>
> + typename EnableIfValidArity<<br>
> + 7, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7> >::type<br>
> + operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,<br>
> + const M5 &P5, const M6 &P6, const M7 &P7) const {<br>
> + return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7>(<br>
> + Func, P1, P2, P3, P4, P5, P6, P7);<br>
> + }<br>
> + template <typename M1, typename M2, typename M3, typename M4, typename M5,<br>
> + typename M6, typename M7, typename M8><br>
> + typename EnableIfValidArity<<br>
> + 8, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8> >::type<br>
> + operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,<br>
> + const M5 &P5, const M6 &P6, const M7 &P7, const M8 &P8) const {<br>
> + return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8>(<br>
> + Func, P1, P2, P3, P4, P5, P6, P7, P8);<br>
> + }<br>
> + template <typename M1, typename M2, typename M3, typename M4, typename M5,<br>
> + typename M6, typename M7, typename M8, typename M9><br>
> + typename EnableIfValidArity<<br>
> + 9, VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8, M9> >::type<br>
> + operator()(const M1 &P1, const M2 &P2, const M3 &P3, const M4 &P4,<br>
> + const M5 &P5, const M6 &P6, const M7 &P7, const M8 &P8,<br>
> + const M9 &P9) const {<br>
> + return VariadicOperatorMatcher<M1, M2, M3, M4, M5, M6, M7, M8, M9>(<br>
> + Func, P1, P2, P3, P4, P5, P6, P7, P8, P9);<br>
> + }<br>
> };<br>
><br>
> /// @}<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div></div>