On Tue, Feb 23, 2016 at 2:29 AM, Alexander Kornienko via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: alexfh
> Date: Tue Feb 23 04:29:04 2016
> New Revision: 261626
>
> URL: http://llvm.org/viewvc/llvm-project?rev=261626&view=rev
> Log:
> Fix a -Wunused-variable diagnostic.
>
> 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=261626&r1=261625&r2=261626&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp (original)
> +++ cfe/trunk/lib/ASTMatchers/ASTMatchersInternal.cpp Tue Feb 23 04:29:04
> 2016
> @@ -307,8 +307,10 @@ HasNameMatcher::HasNameMatcher(std::vect
>            N.begin(), N.end(),
>            [](StringRef Name) { return Name.find("::") == Name.npos; })),
>        Names(std::move(N)) {
> +#ifndef NDEBUG
>    for (StringRef Name : Names)
>      assert(!Name.empty());
>

Alternatively, you could fold the loop into the assert:

assert(llvm::all_of(Names, [](StringRef Name) { return !Name.empty(); }));

(not sure if we have rangified llvm::all_of, but we have some of the other
_of in llvm rangified versions and it would be easy to add this one too)


> +#endif
>  }
>
>  namespace {
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to