From cc2c2c6ca9b8ecffdadd4a1ca7d11a0de1387d24 Mon Sep 17 00:00:00 2001 From: Aaron Gokaslan Date: Thu, 21 Dec 2023 14:58:09 +0000 Subject: [PATCH] [Easy][BE]: Enable clang-tidy check for duplicate includes (#116193) Adds a clang-tidy check to flag duplicate include files Pull Request resolved: https://github.com/pytorch/pytorch/pull/116193 Approved by: https://github.com/albanD, https://github.com/malfet --- .clang-tidy | 1 + aten/src/ATen/core/interned_strings.cpp | 1 - torch/csrc/Dtype.cpp | 2 -- torch/csrc/Module.cpp | 1 - torch/csrc/Size.cpp | 1 - torch/csrc/utils/python_dispatch.cpp | 1 - 6 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 1abd49de546a6..ae6fb3e30e36e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -53,6 +53,7 @@ modernize-*, performance-*, readability-container-size-empty, readability-delete-null-pointer, +readability-duplicate-include readability-string-compare, ' HeaderFilterRegex: '^(aten/|c10/|torch/).*$' diff --git a/aten/src/ATen/core/interned_strings.cpp b/aten/src/ATen/core/interned_strings.cpp index 93239a9507c9c..177ab51fffbbc 100644 --- a/aten/src/ATen/core/interned_strings.cpp +++ b/aten/src/ATen/core/interned_strings.cpp @@ -9,7 +9,6 @@ #include #include #include -#include namespace c10 { diff --git a/torch/csrc/Dtype.cpp b/torch/csrc/Dtype.cpp index d8110c5eafe8a..8eee2a02faec5 100644 --- a/torch/csrc/Dtype.cpp +++ b/torch/csrc/Dtype.cpp @@ -11,8 +11,6 @@ #include #include -#include - PyObject* THPDtype_New(at::ScalarType scalar_type, const std::string& name) { HANDLE_TH_ERRORS AT_ASSERT(name.length() < DTYPE_NAME_LEN); diff --git a/torch/csrc/Module.cpp b/torch/csrc/Module.cpp index bd69351bc16b7..b738e64619ab2 100644 --- a/torch/csrc/Module.cpp +++ b/torch/csrc/Module.cpp @@ -87,7 +87,6 @@ #include #include -#include #include #include #ifdef USE_CUDA diff --git a/torch/csrc/Size.cpp b/torch/csrc/Size.cpp index a13d512e4013a..0e739c7f6a32a 100644 --- a/torch/csrc/Size.cpp +++ b/torch/csrc/Size.cpp @@ -12,7 +12,6 @@ #include #include -#include struct THPSize { PyTupleObject tuple; diff --git a/torch/csrc/utils/python_dispatch.cpp b/torch/csrc/utils/python_dispatch.cpp index c887c822334bc..3908bbe15825f 100644 --- a/torch/csrc/utils/python_dispatch.cpp +++ b/torch/csrc/utils/python_dispatch.cpp @@ -20,7 +20,6 @@ #include #include #include -#include #include #include