<div dir="ltr">BTW, this commit removes the last usage of llvm/ADT/VariadicFunction.h. Should we kill this header?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 8:51 PM, Mehdi Amini via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks!<div><div class="h5"><div><br><div><blockquote type="cite"><div>On Mar 25, 2016, at 12:47 PM, Samuel Benzaquen <<a href="mailto:sbenza@google.com" target="_blank">sbenza@google.com</a>> wrote:</div><br><div><div dir="ltr">Fixed in r264453.<div>Sorry for the inconvenience.</div><div><br></div><div>_Sam</div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 3:31 PM, Samuel Benzaquen <span dir="ltr"><<a href="mailto:sbenza@google.com" target="_blank">sbenza@google.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 dir="ltr">Sorry, this is an unrelated problem.<div>It is using brace-init lists and the supported MSVC version does not support them.</div><div>I'll fix that.<div><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 3:27 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.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 style="word-wrap:break-word">The link I provided is testing r264430...<span><font color="#888888"><div><br></div><div>-- </div><div>Mehdi</div></font></span><div><div><div><br><div><div><div><blockquote type="cite"><div>On Mar 25, 2016, at 12:25 PM, Samuel Benzaquen <<a href="mailto:sbenza@google.com" target="_blank">sbenza@google.com</a>> wrote:</div><br><div><div dir="ltr">I believe r264428 fixes this problem.<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 2:18 PM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.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">Hi,<br>
<br>
I think this broke clang-tidy somehow: <a href="http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10881/steps/build%20stage%201/logs/stdio" rel="noreferrer" target="_blank">http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/10881/steps/build%20stage%201/logs/stdio</a><br>
<br>
--<br>
Mehdi<br>
<br>
<br>
<br>
<br>
> On Mar 25, 2016, at 9:29 AM, Samuel Benzaquen via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br>
><br>
> Author: sbenza<br>
> Date: Fri Mar 25 11:29:30 2016<br>
> New Revision: 264417<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=264417&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=264417&view=rev</a><br>
> Log:<br>
> [ASTMatchers] Add own version of VariadicFunction.<br>
><br>
> Summary:<br>
> llvm::VariadicFunction is only being used by ASTMatchers.<br>
> Having our own copy here allows us to remove the other one from llvm/ADT.<br>
> Also, we can extend the API to meet our needs without modifying the common<br>
> implementation.<br>
><br>
> Reviewers: alexfh<br>
><br>
> Subscribers: klimek, cfe-commits<br>
><br>
> Differential Revision: <a href="http://reviews.llvm.org/D18275" rel="noreferrer" target="_blank">http://reviews.llvm.org/D18275</a><br>
><br>
> Modified:<br>
> cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h<br>
> cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h<br>
> cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h<br>
> cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp<br>
><br>
> Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=264417&r1=264416&r2=264417&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=264417&r1=264416&r2=264417&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)<br>
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Fri Mar 25 11:29:30 2016<br>
> @@ -1990,8 +1990,8 @@ inline internal::Matcher<NamedDecl> hasN<br>
> /// \code<br>
> /// anyOf(hasName(a), hasName(b), hasName(c))<br>
> /// \endcode<br>
> -const llvm::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,<br>
> - internal::hasAnyNameFunc><br>
> +const internal::VariadicFunction<internal::Matcher<NamedDecl>, StringRef,<br>
> + internal::hasAnyNameFunc><br>
> hasAnyName = {};<br>
><br>
> /// \brief Matches NamedDecl nodes whose fully qualified names contain<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=264417&r1=264416&r2=264417&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=264417&r1=264416&r2=264417&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)<br>
> +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Fri Mar 25 11:29:30 2016<br>
> @@ -46,8 +46,9 @@<br>
> #include "clang/AST/StmtCXX.h"<br>
> #include "clang/AST/StmtObjC.h"<br>
> #include "clang/AST/Type.h"<br>
> +#include "llvm/ADT/ArrayRef.h"<br>
> #include "llvm/ADT/Optional.h"<br>
> -#include "llvm/ADT/VariadicFunction.h"<br>
> +#include "llvm/ADT/SmallVector.h"<br>
> #include "llvm/Support/ManagedStatic.h"<br>
> #include <map><br>
> #include <string><br>
> @@ -60,6 +61,39 @@ class BoundNodes;<br>
><br>
> namespace internal {<br>
><br>
> +/// \brief Variadic function object.<br>
> +///<br>
> +/// Most of the functions below that use VariadicFunction could be implemented<br>
> +/// using plain C++11 variadic functions, but the function object allows us to<br>
> +/// capture it on the dynamic matcher registry.<br>
> +template <typename ResultT, typename ArgT,<br>
> + ResultT (*Func)(ArrayRef<const ArgT *>)><br>
> +struct VariadicFunction {<br>
> + ResultT operator()() const { return Func({}); }<br>
> +<br>
> + template <typename... ArgsT><br>
> + ResultT operator()(const ArgT &Arg1, const ArgsT &... Args) const {<br>
> + return Execute(Arg1, static_cast<const ArgT &>(Args)...);<br>
> + }<br>
> +<br>
> + // We also allow calls with an already created array, in case the caller<br>
> + // already had it.<br>
> + ResultT operator()(ArrayRef<ArgT> Args) const {<br>
> + SmallVector<const ArgT*, 8> InnerArgs;<br>
> + for (const ArgT &Arg : Args)<br>
> + InnerArgs.push_back(&Arg);<br>
> + return Func(InnerArgs);<br>
> + }<br>
> +<br>
> +private:<br>
> + // Trampoline function to allow for implicit conversions to take place<br>
> + // before we make the array.<br>
> + template <typename... ArgsT> ResultT Execute(const ArgsT &... Args) const {<br>
> + const ArgT *const ArgsArray[] = {&Args...};<br>
> + return Func(ArgsArray);<br>
> + }<br>
> +};<br>
> +<br>
> /// \brief Unifies obtaining the underlying type of a regular node through<br>
> /// `getType` and a TypedefNameDecl node through `getUnderlyingType`.<br>
> template <typename NodeType><br>
> @@ -1405,9 +1439,8 @@ inline bool ValueEqualsMatcher<FloatingL<br>
> /// casted to CXXRecordDecl and all given matchers match.<br>
> template <typename SourceT, typename TargetT><br>
> class VariadicDynCastAllOfMatcher<br>
> - : public llvm::VariadicFunction<<br>
> - BindableMatcher<SourceT>, Matcher<TargetT>,<br>
> - makeDynCastAllOfComposite<SourceT, TargetT> > {<br>
> + : public VariadicFunction<BindableMatcher<SourceT>, Matcher<TargetT>,<br>
> + makeDynCastAllOfComposite<SourceT, TargetT>> {<br>
> public:<br>
> VariadicDynCastAllOfMatcher() {}<br>
> };<br>
> @@ -1423,9 +1456,9 @@ public:<br>
> /// \c Matcher<NestedNameSpecifier>.<br>
> /// The returned matcher matches if all given matchers match.<br>
> template <typename T><br>
> -class VariadicAllOfMatcher : public llvm::VariadicFunction<<br>
> - BindableMatcher<T>, Matcher<T>,<br>
> - makeAllOfComposite<T> > {<br>
> +class VariadicAllOfMatcher<br>
> + : public VariadicFunction<BindableMatcher<T>, Matcher<T>,<br>
> + makeAllOfComposite<T>> {<br>
> public:<br>
> VariadicAllOfMatcher() {}<br>
> };<br>
> @@ -1546,8 +1579,8 @@ public:<br>
> new MatcherImpl<OuterT>(InnerMatcher, Getter<OuterT>::value()));<br>
> }<br>
><br>
> - struct Func : public llvm::VariadicFunction<Self, Matcher<InnerTBase>,<br>
> - &Self::create> {<br>
> + struct Func<br>
> + : public VariadicFunction<Self, Matcher<InnerTBase>, &Self::create> {<br>
> Func() {}<br>
> };<br>
><br>
><br>
> Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h?rev=264417&r1=264416&r2=264417&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h?rev=264417&r1=264416&r2=264417&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h (original)<br>
> +++ cfe/trunk/lib/ASTMatchers/Dynamic/Marshallers.h Fri Mar 25 11:29:30 2016<br>
> @@ -325,8 +325,9 @@ public:<br>
><br>
> template <typename ResultT, typename ArgT,<br>
> ResultT (*F)(ArrayRef<const ArgT *>)><br>
> - VariadicFuncMatcherDescriptor(llvm::VariadicFunction<ResultT, ArgT, F> Func,<br>
> - StringRef MatcherName)<br>
> + VariadicFuncMatcherDescriptor(<br>
> + ast_matchers::internal::VariadicFunction<ResultT, ArgT, F> Func,<br>
> + StringRef MatcherName)<br>
> : Func(&variadicMatcherDescriptor<ResultT, ArgT, F>),<br>
> MatcherName(MatcherName.str()),<br>
> ArgsKind(ArgTypeTraits<ArgT>::getKind()) {<br>
> @@ -655,9 +656,9 @@ MatcherDescriptor *makeMatcherAutoMarsha<br>
> /// \brief Variadic overload.<br>
> template <typename ResultT, typename ArgT,<br>
> ResultT (*Func)(ArrayRef<const ArgT *>)><br>
> -MatcherDescriptor *<br>
> -makeMatcherAutoMarshall(llvm::VariadicFunction<ResultT, ArgT, Func> VarFunc,<br>
> - StringRef MatcherName) {<br>
> +MatcherDescriptor *makeMatcherAutoMarshall(<br>
> + ast_matchers::internal::VariadicFunction<ResultT, ArgT, Func> VarFunc,<br>
> + StringRef MatcherName) {<br>
> return new VariadicFuncMatcherDescriptor(VarFunc, MatcherName);<br>
> }<br>
><br>
><br>
> Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=264417&r1=264416&r2=264417&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=264417&r1=264416&r2=264417&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)<br>
> +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Fri Mar 25 11:29:30 2016<br>
> @@ -3000,6 +3000,9 @@ TEST(Matcher, HasAnyName) {<br>
> EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyName("::C", "::b::C"))));<br>
> EXPECT_TRUE(<br>
> matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C"))));<br>
> +<br>
> + std::vector<StringRef> Names = {"::C", "::b::C", "::a::b::C"};<br>
> + EXPECT_TRUE(matches(Code, recordDecl(hasAnyName(Names))));<br>
> }<br>
><br>
> TEST(Matcher, IsDefinition) {<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br>
</blockquote></div><br></div></div>
</div></blockquote></div><br></div></div></div></div></div></div></blockquote></div><br></div></div></div></div></div>
</blockquote></div><br></div></div></div>
</div></blockquote></div><br></div></div></div></div><br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>