[clang-tools-extra] Add checks to convert std library iterator algorithms into c++20 or boost ranges (PR #97764)

Piotr Zegar via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 5 00:42:06 PDT 2024


================
@@ -0,0 +1,58 @@
+//===--- UseRangesCheck.h - clang-tidy --------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_USERANGESCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_UTILS_USERANGESCHECK_H
+
+#include "../ClangTidyCheck.h"
+#include "IncludeInserter.h"
+#include "clang/AST/Decl.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringMap.h"
+
+namespace clang::tidy::utils {
+
+/// FIXME: Base class for handling converting std iterator algorithms to a range
+/// equivalent
+class UseRangesCheck : public ClangTidyCheck {
+public:
+  class Replacer : public llvm::RefCountedBase<Replacer> {
+  public:
+    struct Indexes {
+      enum Replace { First, Second };
+      unsigned BeginArg;
----------------
PiotrZSL wrote:

Nit: `BeginArg = 0U`,

https://github.com/llvm/llvm-project/pull/97764


More information about the cfe-commits mailing list