Use clang-tidy 17 (#139678)

Fixes #ISSUE_NUMBER

Pull Request resolved: https://github.com/pytorch/pytorch/pull/139678
Approved by: https://github.com/Skylion007
This commit is contained in:
cyy
2024-11-05 16:00:25 +00:00
committed by PyTorch MergeBot
parent e0156f9faa
commit a2bc2e38f9
8 changed files with 9 additions and 5 deletions

View File

@ -64,5 +64,5 @@ readability-string-compare,
HeaderFilterRegex: '^(aten/|c10/|torch/).*$'
WarningsAsErrors: '*'
CheckOptions:
misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h'
misc-header-include-cycle.IgnoredFilesList: 'format.h;ivalue.h;custom_class.h;Dict.h;List.h;IListRef.h'
...

View File

@ -234,7 +234,7 @@ struct C10_API InefficientStdFunctionContext {
deleter_(std::move(rhs.deleter_)) {}
InefficientStdFunctionContext& operator=(
const InefficientStdFunctionContext&) = delete;
// NOLINTNEXTLINE(performance-noexcept-move-constructor)
// NOLINTNEXTLINE(*-noexcept-move-*)
InefficientStdFunctionContext& operator=(
InefficientStdFunctionContext&& rhs) {
this->~InefficientStdFunctionContext();

View File

@ -230,6 +230,7 @@ TEST(MetaprogrammingTest, TupleMap_mapsToDifferentTypes) {
TEST(MetaprogrammingTest, TupleMap_differentiatesLRValueReferences) {
struct Mapper {
// NOLINTNEXTLINE(*move*)
std::string operator()(std::string&& a) const {
return "moved";
}

View File

@ -23,6 +23,7 @@ TEST(LoggingTest, TestEnforceFalse) {
CAFFE_ENFORCE(false, "This throws.");
// This should never be triggered.
ADD_FAILURE();
// NOLINTNEXTLINE(*catch*)
} catch (const ::c10::Error&) {
}
std::swap(FLAGS_caffe2_use_fatal_for_enforce, kFalse);

View File

@ -57,6 +57,7 @@ struct bitset final {
// Call the given functor with the index of each bit that is set
template <class Func>
// NOLINTNEXTLINE(cppcoreguidelines-missing-std-forward)
void for_each_set_bit(Func&& func) const {
bitset cur = *this;
size_t index = cur.find_first_set();

View File

@ -37,6 +37,7 @@ std::atomic<int> sighupCount(0);
std::atomic<int> hookedUpCount(0);
void handleSignal(int signal) {
// NOLINTNEXTLINE(bugprone-switch-missing-default-case)
switch (signal) {
// TODO: what if the previous handler uses sa_sigaction?
case SIGHUP:

View File

@ -30,8 +30,8 @@
"hash": "4ed664cf50bb9fddec2d4170b3d7bbe0135dc5648acbd620b61c8d25a5a2fdb7"
},
"Linux": {
"download_url": "https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/15.0.6/clang-tidy",
"hash": "8defeb3a2698caca60251f9d682bc08374f1a37eec77d515533affdd03f93add"
"download_url": "https://oss-clang-format.s3.us-east-2.amazonaws.com/linux64/17.0.6/clang-tidy",
"hash": "a93110b0d58b430bb7ce86c8497f2528e1d44eed25d546557e7ec45c44ddfeb7"
}
},
"actionlint": {

View File

@ -1,5 +1,5 @@
#pragma once
#include <torch/csrc/utils/python_compat.h>
namespace torch::autograd {
void initNNFunctions(PyObject* module);