r264428 - [ASTMatchers] Fix build for VariadicFunction.

Samuel Benzaquen via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 28 07:00:44 PDT 2016


On Fri, Mar 25, 2016 at 7:01 PM, Richard Smith <richard at metafoo.co.uk>
wrote:

> On Fri, Mar 25, 2016 at 10:55 AM, David Blaikie via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
> >
> >
> > On Fri, Mar 25, 2016 at 10:46 AM, Samuel Benzaquen via cfe-commits
> > <cfe-commits at lists.llvm.org> wrote:
> >>
> >> Author: sbenza
> >> Date: Fri Mar 25 12:46:02 2016
> >> New Revision: 264428
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=264428&view=rev
> >> Log:
> >> [ASTMatchers] Fix build for VariadicFunction.
> >>
> >> Under some conditions the implicit conversion from array to ArrayRef<>
> >> is not working.
> >
> > Any idea what those conditions are?
>
> Well, the code's ill-formed (relying on a compiler extension) when
> Args is empty. Maybe GCC diagnoses that in some cases?
>

But Args is never empty on this function.
It is only every called from the 1+ arg overload of operator().
There is another overload for the 0-arg case to prevent this problem.


>
> >> Fix the build by making it explicit.
> >>
> >> 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=264428&r1=264427&r2=264428&view=diff
> >>
> >>
> ==============================================================================
> >> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
> >> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Fri Mar 25
> >> 12:46:02 2016
> >> @@ -90,7 +90,7 @@ private:
> >>    // before we make the array.
> >>    template <typename... ArgsT> ResultT Execute(const ArgsT &... Args)
> >> const {
> >>      const ArgT *const ArgsArray[] = {&Args...};
> >> -    return Func(ArgsArray);
> >> +    return Func(ArrayRef<const ArgT *>(ArgsArray, sizeof...(ArgsT)));
> >>    }
> >>  };
> >>
> >>
> >>
> >> _______________________________________________
> >> cfe-commits mailing list
> >> cfe-commits at lists.llvm.org
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160328/c540ea76/attachment-0001.html>


More information about the cfe-commits mailing list