<div dir="ltr">Thanks. Fixed thus:<div><br></div><div><a href="https://reviews.llvm.org/rG5935952c3108c99bd865411845c4b02a6234a1d5">https://reviews.llvm.org/rG5935952c3108c99bd865411845c4b02a6234a1d5</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 16, 2020 at 7:04 PM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, Nov 15, 2020 at 7:01 PM Kazu Hirata via llvm-commits<br>
<<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br>
><br>
><br>
> Author: Kazu Hirata<br>
> Date: 2020-11-15T19:01:20-08:00<br>
> New Revision: 918e3439e20d068b3336febf084d7e11baa48311<br>
><br>
> URL: <a href="https://github.com/llvm/llvm-project/commit/918e3439e20d068b3336febf084d7e11baa48311" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/918e3439e20d068b3336febf084d7e11baa48311</a><br>
> DIFF: <a href="https://github.com/llvm/llvm-project/commit/918e3439e20d068b3336febf084d7e11baa48311.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/918e3439e20d068b3336febf084d7e11baa48311.diff</a><br>
><br>
> LOG: [SanitizerCoverage] Use llvm::all_of (NFC)<br>
><br>
> Added:<br>
><br>
><br>
> Modified:<br>
>     llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
><br>
> Removed:<br>
><br>
><br>
><br>
> ################################################################################<br>
> diff  --git a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> index 7e2d5260fb6c..f4f94edd3ce2 100644<br>
> --- a/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> +++ b/llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp<br>
> @@ -519,29 +519,23 @@ bool ModuleSanitizerCoverage::instrumentModule(<br>
><br>
>  // True if block has successors and it dominates all of them.<br>
>  static bool isFullDominator(const BasicBlock *BB, const DominatorTree *DT) {<br>
> -  if (succ_begin(BB) == succ_end(BB))<br>
> +  if (succ_empty(BB))<br>
>      return false;<br>
><br>
> -  for (const BasicBlock *SUCC : make_range(succ_begin(BB), succ_end(BB))) {<br>
> -    if (!DT->dominates(BB, SUCC))<br>
> -      return false;<br>
> -  }<br>
> -<br>
> -  return true;<br>
> +  return llvm::all_of(successors(BB), [BB, DT](const BasicBlock *SUCC) {<br>
> +    return DT->dominates(BB, SUCC);<br>
> +  });<br>
>  }<br>
><br>
>  // True if block has predecessors and it postdominates all of them.<br>
>  static bool isFullPostDominator(const BasicBlock *BB,<br>
>                                  const PostDominatorTree *PDT) {<br>
> -  if (pred_begin(BB) == pred_end(BB))<br>
> +  if (pred_empty(BB))<br>
>      return false;<br>
><br>
> -  for (const BasicBlock *PRED : make_range(pred_begin(BB), pred_end(BB))) {<br>
> -    if (!PDT->dominates(BB, PRED))<br>
> -      return false;<br>
> -  }<br>
> -<br>
> -  return true;<br>
> +  return llvm::all_of(predecessors(BB), [BB, PDT](const BasicBlock *PRED) {<br>
<br>
Generally for locally scoped lambdas (ones that aren't captured/escape<br>
their scope) I'd suggest using "[&]" for captures as it makes changes<br>
to the code simpler - there's no need to think about which variables<br>
are or are not captured.<br>
<br>
> +    return PDT->dominates(BB, PRED);<br>
> +  });<br>
>  }<br>
><br>
>  static bool shouldInstrumentBlock(const Function &F, const BasicBlock *BB,<br>
><br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>