[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 5 14:11:08 PDT 2024
================
@@ -0,0 +1,181 @@
+//===--- UseRangesCheck.cpp - clang-tidy ----------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "UseRangesCheck.h"
+#include "clang/AST/Decl.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include <initializer_list>
+
+// FixItHint - Let the docs script know that this class does provide fixits
+
+namespace clang::tidy::modernize {
+
+static constexpr const char *SingleRangeNames[] = {
+ "all_of",
+ "any_of",
+ "none_of",
+ "for_each",
+ "find",
+ "find_if",
+ "find_if_not",
+ "adjacent_find",
+ "copy",
+ "copy_if",
+ "copy_backward",
+ "move",
+ "move_backward",
+ "fill",
+ "transform",
+ "replace",
+ "replace_if",
+ "generate",
+ "remove",
+ "remove_if",
+ "remove_copy",
+ "remove_copy_if",
+ "unique",
+ "unique_copy",
+ "sample",
+ "partition_point",
+ "lower_bound",
+ "upper_bound",
+ "equal_range",
+ "binary_search",
+ "push_heap",
+ "pop_heap",
+ "make_heap",
+ "sort_heap",
+ "next_permutation",
+ "prev_permutation",
+ "iota",
----------------
5chmidti wrote:
The range version of `iota` was added in C++23 (https://en.cppreference.com/w/cpp/algorithm/ranges/iota), and it is available in the `numeric` header instead of the `algorithm` header.
https://github.com/llvm/llvm-project/pull/97764
More information about the cfe-commits
mailing list