[clang-tools-extra] [clang-tidy] Add llvm-use-vector-utils (PR #177722)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 24 07:36:32 PST 2026
================
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_LLVM_USEVECTORUTILSCHECK_H
+#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_LLVM_USEVECTORUTILSCHECK_H
+
+#include "../ClangTidyCheck.h"
+#include "../utils/IncludeInserter.h"
+
+namespace clang::tidy::llvm_check {
+
+/// Finds calls to `llvm::to_vector(llvm::map_range(...))` and
+/// `llvm::to_vector(llvm::make_filter_range(...))` that can be replaced with
+/// `llvm::map_to_vector` and `llvm::filter_to_vector` from
+/// `SmallVectorExtras.h`.
+///
+/// For the user-facing documentation see:
+/// https://clang.llvm.org/extra/clang-tidy/checks/llvm/use-vector-utils.html
+class UseVectorUtilsCheck : public ClangTidyCheck {
+public:
+ UseVectorUtilsCheck(StringRef Name, ClangTidyContext *Context);
+ bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
----------------
EugeneZelenko wrote:
It's usually placed after `registerMatchers`, `check`, etc.
https://github.com/llvm/llvm-project/pull/177722
More information about the cfe-commits
mailing list