Skip to content

Commit 918e343

Browse files
[SanitizerCoverage] Use llvm::all_of (NFC)
1 parent 400f6ed commit 918e343

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -519,29 +519,23 @@ bool ModuleSanitizerCoverage::instrumentModule(
519519

520520
// True if block has successors and it dominates all of them.
521521
static bool isFullDominator(const BasicBlock *BB, const DominatorTree *DT) {
522-
if (succ_begin(BB) == succ_end(BB))
522+
if (succ_empty(BB))
523523
return false;
524524

525-
for (const BasicBlock *SUCC : make_range(succ_begin(BB), succ_end(BB))) {
526-
if (!DT->dominates(BB, SUCC))
527-
return false;
528-
}
529-
530-
return true;
525+
return llvm::all_of(successors(BB), [BB, DT](const BasicBlock *SUCC) {
526+
return DT->dominates(BB, SUCC);
527+
});
531528
}
532529

533530
// True if block has predecessors and it postdominates all of them.
534531
static bool isFullPostDominator(const BasicBlock *BB,
535532
const PostDominatorTree *PDT) {
536-
if (pred_begin(BB) == pred_end(BB))
533+
if (pred_empty(BB))
537534
return false;
538535

539-
for (const BasicBlock *PRED : make_range(pred_begin(BB), pred_end(BB))) {
540-
if (!PDT->dominates(BB, PRED))
541-
return false;
542-
}
543-
544-
return true;
536+
return llvm::all_of(predecessors(BB), [BB, PDT](const BasicBlock *PRED) {
537+
return PDT->dominates(BB, PRED);
538+
});
545539
}
546540

547541
static bool shouldInstrumentBlock(const Function &F, const BasicBlock *BB,

0 commit comments

Comments
 (0)