[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:09 PDT 2024
================
@@ -0,0 +1,68 @@
+//===--- 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 "clang/AST/Expr.h"
+#include "clang/Basic/Diagnostic.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/StringMap.h"
+
+namespace clang::tidy::utils {
+
+/// Base class for handling converting std iterator algorithms to a range
+/// equivalent.
+class UseRangesCheck : public ClangTidyCheck {
+public:
+ struct Indexes {
+ enum Replace { First, Second };
+ unsigned BeginArg;
+ unsigned EndArg = BeginArg + 1;
+ Replace ReplaceArg = First;
+ };
----------------
5chmidti wrote:
It's possible to remove all uses of the `Replace` enum and `ReplaceArg`. The only uses of them were in `utils/UseRanges.cpp`, but no `Indexes` got it's `ReplaceArg` set to `Second`.
https://github.com/llvm/llvm-project/pull/97764
More information about the cfe-commits
mailing list