[all-commits] [llvm/llvm-project] f119a2: [BOLT][NFC] Use llvm::any_of

Amir Ayupov via All-commits all-commits at lists.llvm.org
Sat Aug 27 21:36:31 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f119a2483d4fd72fe88bfc367822bcd045117e1e
      https://github.com/llvm/llvm-project/commit/f119a2483d4fd72fe88bfc367822bcd045117e1e
  Author: Amir Ayupov <aaupov at fb.com>
  Date:   2022-08-27 (Sat, 27 Aug 2022)

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

  Log Message:
  -----------
  [BOLT][NFC] Use llvm::any_of

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

Reviewed By: rafauler

Differential Revision: https://reviews.llvm.org/D132276




More information about the All-commits mailing list