r229374 - ASTMatchers: Replace enable_if with static_assert.

Benjamin Kramer benny.kra at gmail.com
Thu Feb 19 04:02:11 PST 2015


> On 19.02.2015, at 03:07, Richard Smith <richard at metafoo.co.uk> wrote:
> 
> On Mon, Feb 16, 2015 at 3:08 AM, Benjamin Kramer <benny.kra at googlemail.com> wrote:
> Author: d0k
> Date: Mon Feb 16 05:08:00 2015
> New Revision: 229374
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=229374&view=rev
> Log:
> ASTMatchers: Replace enable_if with static_assert.
> 
> This is nicer in general and gives a better error message, but it also might
> bring MSVC 2013 back to life.
> 
> Modified:
>     cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> 
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=229374&r1=229373&r2=229374&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Mon Feb 16 05:08:00 2015
> @@ -1178,14 +1178,10 @@ template <unsigned MinCount, unsigned Ma
>  struct VariadicOperatorMatcherFunc {
>    DynTypedMatcher::VariadicOperator Op;
> 
> -  template <unsigned Count, typename T>
> -  struct EnableIfValidArity
> -      : public std::enable_if<MinCount <= Count && Count <= MaxCount, T> {};
> -
>    template <typename... Ms>
> -  typename EnableIfValidArity<sizeof...(Ms),
> -                              VariadicOperatorMatcher<Ms...>>::type
> -  operator()(Ms &&... Ps) const {
> +  VariadicOperatorMatcher<Ms...> operator()(Ms &&... Ps) const {
> 
> Why the space after the '...'? That seems to be in conflict with the usual LLVM style.

Lacking precedent in LLVM I let clang-format decide how to format this piece of code. If LLVM's style prefers to leave out the space we should fix clang-format first ;)

- Ben





More information about the cfe-commits mailing list