This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][NFC] Use llvm::any_of
ClosedPublic

Authored by Amir on Aug 19 2022, 9:13 PM.

Details

Summary

Replace the imperative pattern of the following kind

bool IsTrue = false;
for (Element : Range) {
  if (Condition(Element)) {
    IsTrue = true;
    break;
  }
}

with functional style llvm::any_of:

bool IsTrue = llvm::any_of(Range, [&](Element) {
  return Condition(Element);
});

Diff Detail

Event Timeline

Amir created this revision.Aug 19 2022, 9:13 PM
Herald added a reviewer: maksfb. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: ayermolo. · View Herald Transcript
Amir requested review of this revision.Aug 19 2022, 9:13 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2022, 9:13 PM
This revision is now accepted and ready to land.Aug 22 2022, 12:24 PM
This revision was automatically updated to reflect the committed changes.