62 lines · plain
1.. title:: clang-tidy - llvm-use-ranges2 3llvm-use-ranges4===============5 6Finds calls to STL library iterator algorithms that could be replaced with7LLVM range-based algorithms from ``llvm/ADT/STLExtras.h``.8 9Example10-------11 12.. code-block:: c++13 14 auto it = std::find(vec.begin(), vec.end(), value);15 bool all = std::all_of(vec.begin(), vec.end(),16 [](int x) { return x > 0; });17 18Transforms to:19 20.. code-block:: c++21 22 auto it = llvm::find(vec, value);23 bool all = llvm::all_of(vec, [](int x) { return x > 0; });24 25Supported algorithms26--------------------27 28Calls to the following STL algorithms are checked:29 30``std::all_of``,31``std::any_of``,32``std::binary_search``,33``std::copy``,34``std::copy_if``,35``std::count``,36``std::count_if``,37``std::equal``,38``std::fill``,39``std::find``,40``std::find_if``,41``std::find_if_not``,42``std::for_each``,43``std::includes``,44``std::is_sorted``,45``std::lower_bound``,46``std::max_element``,47``std::min_element``,48``std::mismatch``,49``std::none_of``,50``std::partition``,51``std::partition_point``,52``std::remove_if``,53``std::replace``,54``std::stable_sort``,55``std::transform``,56``std::uninitialized_copy``,57``std::unique``,58``std::upper_bound``.59 60The check will add the necessary ``#include "llvm/ADT/STLExtras.h"`` directive61when applying fixes.62