forked from OSchip/llvm-project
[Docs] CodingStandards: for_each is discouraged
Summary: As per disscussion in D83351, using `for_each` is potentially confusing, at least in regards to inconsistent style (there's less than 100 `for_each` usages in LLVM, but ~100.000 `for` range-based loops Therefore, it should be avoided. Reviewers: dblaikie, nickdesaulniers Reviewed By: dblaikie, nickdesaulniers Subscribers: hubert.reinterpretcast, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D83431
This commit is contained in:
parent
caa423eef0
commit
29a9dd5bfe
|
@ -1302,6 +1302,9 @@ loops wherever possible for all newly added code. For example:
|
|||
for (Instruction &I : *BB)
|
||||
... use I ...
|
||||
|
||||
Usage of ``std::for_each()``/``llvm::for_each()`` functions is discouraged,
|
||||
unless the the callable object already exists.
|
||||
|
||||
Don't evaluate ``end()`` every time through a loop
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
|
Loading…
Reference in New Issue