<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/132112>132112</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] `modernize-loop-convert` - needs a way to enable reverse pipe syntax
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          denzor200
      </td>
    </tr>
</table>

<pre>
    
The check `modernize-loop-convert` never generates the code with pipe sintax like `for (int i : il | std::views::reverse)` while `modernize-use-ranges` does.
Needs an option/options to make it possible.

In my opinion we need to add these 3 new options:
**UseReversePipe** - When true (default false), fixes which involve reverse ranges will use the pipe adaptor syntax instead of the function syntax
ReverseRange
**MakeReverseRangePipeAdaptor** - Specify the pipe adaptor used to reverse a range, the adaptor should accept a class with `rbegin` and `rend` methods and return a class with `begin` and `end` methods that call the `rbegin` and `rend` methods respectively. Common examples are `std::views::reverse` and `boost::adaptors::reversed`. Default value is an empty string.
**MakeReverseRangeHeader** - Specifies the header file where MakeReverseRangePipeAdaptor is declared. For the previous examples this option would be set to `ranges` and `boost/range/adaptor/reversed.hpp` respectively. If this is an empty string and MakeReverseRangePipeAdaptor is set, the check will take the value from MakeReverseRangeHeader option. This can be wrapped in angle brackets to signify to add the include as a system include. Default value is an empty string.

EXAMPLE - without pipe sintax:
```
#include <boost/range/adaptors.hpp>

int main() {
 std::string str = "abcdefghijklmnopqrstuvwxyz";

    std::cout << "Reversed abc: ";
    for (char c : boost::adaptors::reverse(str)) {
 std::cout << c;
    }
    std::cout << std::endl;
}
```
Configuration:
UseCxx20ReverseRanges = true
MakeReverseRangeFunction = "boost::adaptors::reverse"
MakeReverseRangeHeader = "boost/range/adaptor/reversed.hpp"
UseReversePipe = false
MakeReverseRangePipeAdaptor = ""
MakeReverseRangeHeader = ""



EXAMPLE - with pipe sintax:
```
#include <boost/range/adaptors.hpp>

int main() {
    std::string str = "abcdefghijklmnopqrstuvwxyz";

    std::cout << "Reversed abc: ";
 for (char c : str | boost::adaptors::reversed) {
        std::cout << c;
 }
    std::cout << std::endl;
}
```
Configuration:
UseCxx20ReverseRanges = true
MakeReverseRangeFunction = "boost::adaptors::reverse"
MakeReverseRangeHeader = "boost/range/adaptor/reversed.hpp"
UseReversePipe = true
MakeReverseRangePipeAdaptor = "boost::adaptors::reversed"
MakeReverseRangeHeader = ""

</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsV02P2zgP_jXKhUjgyJNJc8jBzTR4C7xdFN0Wu1dZom11ZMkrysmkv34h2flqOh-nnhYwMB5ZJB8-fEgpgkjXFnHNFu_Z4mEi-tA4v1ZofzjPs2xSOnVYs6z42iDIBuUjsPusdQq91T9wapzrptLZHfrA7jOwuEMPNVr0IiBBiGZOIex1aKDTHQJpG8QTGP2I0VflPDD-TtsAGlhegDbAlhugoFhesLzYadzT8Oqjd0LGVzHWvtEGr-H0hFMvbI0UNyiHNGNZ8QeiIhAWXBe0s4xvhxeC4KAVjwg6QOeIdGkwGrCs-GihPYDrtNXOwh7BIqq4XygVsyKEHCzuR58JYFYwHp9vhF8GpJ91h8MaTOGvBi0E32PMV2ElehOgEmZIiG-g0k9IMS3ZgLY7Z3YIY8owZAV7bQz0hInYRKdQogvOAx0SrdpSQKHAVWlL1VsZ8Y2fWVaMyL5EfyfEn8QjXn6IuIvB8Qn-nx1KXR1uI_c0MHOEKgawMaO49wSwcb1RIKTELoAAaQTRoAt2n_kSa21j1YRVaQGtiv-2GBqXyqfAY-i9vbH92fQny9CIAFIYk-C8JZZH6lAGvUNzmMHGta2zgE-i7QwSCJ-8vCTQs-vSOQrDx5GI660x7gweRjXshOkRdBIrtl04AAWvbT17tlL_Q6Hw5yLpsfOa9BGq2Cf7Bj3CC4WOYRVKIzyqGWydHyrtcaddT-f0Q6NpVD3sU0lLBMIQJRC5PLXfFQN8O4piK4662h4pmD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