adjust header inclusions in C10 as sugguested by IWYU (#102467)

This PR aims to reduce unused header inclusions in C10.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/102467
Approved by: https://github.com/albanD
This commit is contained in:
cyy 2023-05-31 19:19:05 +00:00 committed by PyTorch MergeBot
parent 0ecca122e7
commit 3ae42cb7db
13 changed files with 14 additions and 25 deletions

View File

@ -2,6 +2,7 @@
#include <c10/core/DeviceType.h>
#include <c10/macros/Export.h>
#include <cstdint>
#include <ostream>
#include <string>

View File

@ -1,4 +1,5 @@
#include <c10/core/StorageImpl.h>
#include <c10/util/flat_hash_map.h>
namespace c10 {

View File

@ -4,8 +4,6 @@
#include <c10/core/SymInt.h>
#include <c10/core/impl/PyObjectSlot.h>
#include <c10/util/Optional.h>
#include <c10/util/flat_hash_map.h>
#include <c10/util/intrusive_ptr.h>
namespace c10 {

View File

@ -1,7 +1,5 @@
#include <c10/core/impl/LocalDispatchKeySet.h>
#include <iostream>
namespace c10 {
namespace impl {

View File

@ -1,8 +1,7 @@
#pragma once
#include <c10/core/DispatchKeySet.h>
#include <c10/macros/Macros.h>
#include <c10/util/Flags.h>
#include <c10/macros/Export.h>
// TLS management for DispatchKeySet (the "local" DispatchKeySet(s))
//

View File

@ -2,6 +2,7 @@
#include <c10/core/impl/cow/deleter.h>
#include <c10/util/Exception.h>
#include <mutex>
namespace c10::impl {

View File

@ -1,12 +1,11 @@
#pragma once
#include <c10/macros/Macros.h>
#include <c10/macros/Export.h>
#include <c10/util/UniqueVoidPtr.h>
#include <atomic>
#include <cstdint>
#include <memory>
#include <mutex>
#include <shared_mutex>
#include <variant>

View File

@ -5,7 +5,7 @@
#pragma once
#include <c10/macros/Macros.h>
#include <c10/macros/Export.h>
namespace c10 {
namespace impl {

View File

@ -1,6 +1,6 @@
#include <c10/mobile/CPUCachingAllocator.h>
#include <c10/core/impl/alloc_cpu.h>
#include <c10/mobile/CPUCachingAllocator.h>
#include <c10/util/Exception.h>
namespace c10 {

View File

@ -1,11 +1,7 @@
#pragma once
#include <algorithm>
#include <deque>
#include <memory>
#include <mutex>
#include <c10/util/Exception.h>
#include <c10/util/SmallVector.h>
#include <c10/util/flat_hash_map.h>

View File

@ -1,11 +1,10 @@
#include <c10/util/Flags.h>
#include <string>
#include <c10/macros/Macros.h>
#ifdef C10_USE_GFLAGS
#include <c10/util/Flags.h>
#include <string>
namespace c10 {
using std::string;

View File

@ -1,18 +1,16 @@
#include <c10/util/Backtrace.h>
#include <c10/util/Logging.h>
#include <c10/util/signal_handler.h>
#if defined(C10_SUPPORTS_SIGNAL_HANDLER)
// Normal signal handler implementation.
#include <cxxabi.h>
#include <dirent.h>
#include <dlfcn.h>
#include <fmt/format.h>
#include <fmt/core.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <unwind.h>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <iostream>

View File

@ -5,7 +5,6 @@
#include <mutex>
#include <c10/macros/Export.h>
#include <c10/util/Logging.h>
#if defined(__APPLE__)
#define C10_SUPPORTS_SIGNAL_HANDLER