[PATCH] D132276: [BOLT][NFC] Use llvm::any_of

Amir Ayupov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 21:14:00 PDT 2022


Amir created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: maksfb.
Herald added a project: All.
Amir requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

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);
  });


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132276

Files:
  bolt/include/bolt/Core/DebugData.h
  bolt/lib/Core/BinaryFunction.cpp
  bolt/lib/Passes/FrameAnalysis.cpp
  bolt/lib/Passes/PatchEntries.cpp
  bolt/lib/Passes/ReorderData.cpp
  bolt/lib/Passes/ShrinkWrapping.cpp
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Rewrite/RewriteInstance.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132276.454159.patch
Type: text/x-patch
Size: 8465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220820/9af737d0/attachment.bin>


More information about the llvm-commits mailing list