================ @@ -0,0 +1,40 @@ +//===--- UseSpanFirstLastCheck.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_MODERNIZE_USESPANFIRSTLASTCHECK_H +#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_USESPANFIRSTLASTCHECK_H + +#include "../ClangTidyCheck.h" + +namespace clang::tidy::modernize { + +/// Converts std::span::subspan() calls to the more modern first()/last() +/// methods where applicable. +/// +/// For example: +/// \code +/// std::span<int> s = ...; +/// auto sub = s.subspan(0, n); // -> auto sub = s.first(n); +/// auto sub2 = s.subspan(n); // -> auto sub2 = s.last(s.size() - n); +/// \endcode +class UseSpanFirstLastCheck : public ClangTidyCheck { +public: + UseSpanFirstLastCheck(StringRef Name, ClangTidyContext *Context) ---------------- carlosgalvezp wrote:
Limit this check to C++20 https://github.com/llvm/llvm-project/pull/118074 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits