[Reland] [11/N] Enable clang-tidy warnings on c10/util/*.h (#116751)

Reland of #116353 with C++ diagnostic macros restored.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/116751
Approved by: https://github.com/albanD
This commit is contained in:
cyy
2024-01-08 11:07:55 +00:00
committed by PyTorch MergeBot
parent e780213340
commit ad507789d1
21 changed files with 80 additions and 86 deletions

View File

@ -125,6 +125,7 @@ class ArrayRef final {
/// Construct an ArrayRef from a C array.
template <size_t N>
// NOLINTNEXTLINE(*c-arrays*)
/* implicit */ constexpr ArrayRef(const T (&Arr)[N]) : Data(Arr), Length(N) {}
/// Construct an ArrayRef from a std::initializer_list.
@ -238,6 +239,7 @@ class ArrayRef final {
/// continues to select the move assignment operator.
template <typename U>
std::enable_if_t<std::is_same_v<U, T>, ArrayRef<T>>& operator=(
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
U&& Temporary) = delete;
/// Disallow accidental assignment from a temporary.
@ -330,6 +332,7 @@ ArrayRef<T>& makeArrayRef(ArrayRef<T>& Vec) {
/// Construct an ArrayRef from a C array.
template <typename T, size_t N>
// NOLINTNEXTLINE(*c-arrays*)
ArrayRef<T> makeArrayRef(const T (&Arr)[N]) {
return ArrayRef<T>(Arr);
}