[NFC] Additional header dependency cleanup LLVMSupport
authorserge-sans-paille <sguelton@redhat.com>
Wed, 26 Jan 2022 07:50:00 +0000 (02:50 -0500)
committerserge-sans-paille <sguelton@redhat.com>
Wed, 26 Jan 2022 10:16:15 +0000 (11:16 +0100)
A few more forward-declarations, a few less headers. the impact on number of
preprocessed lines for LLVMSupport is negligible (-3K lines) but it's always
good to remove dependencies.

Related discourse thread: https://llvm.discourse.group/t/include-what-you-use-include-cleanup

14 files changed:
llvm/include/llvm/ADT/SmallVector.h
llvm/include/llvm/Support/ARMTargetParser.h
llvm/include/llvm/Support/ConvertUTF.h
llvm/include/llvm/Support/TargetParser.h
llvm/include/llvm/Support/ThreadPool.h
llvm/include/llvm/Support/X86TargetParser.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/Support/BinaryStreamError.cpp
llvm/lib/Support/CrashRecoveryContext.cpp
llvm/lib/Support/FileUtilities.cpp
llvm/lib/Support/MemoryBuffer.cpp
llvm/lib/Support/TargetParser.cpp
llvm/lib/Support/ThreadPool.cpp
llvm/lib/Support/YAMLTraits.cpp

index 9347f01..466acb8 100644 (file)
@@ -13,7 +13,6 @@
 #ifndef LLVM_ADT_SMALLVECTOR_H
 #define LLVM_ADT_SMALLVECTOR_H
 
-#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include <algorithm>
@@ -32,6 +31,8 @@
 
 namespace llvm {
 
+template <typename IteratorT> class iterator_range;
+
 /// This is all the stuff common to all SmallVectors.
 ///
 /// The template parameter specifies the type which should be used to hold the
index b40704c..1ada6da 100644 (file)
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_ARMTARGETPARSER_H
 #define LLVM_SUPPORT_ARMTARGETPARSER_H
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ARMBuildAttributes.h"
 #include <vector>
index 1add185..374cdb9 100644 (file)
 
 #include <cstddef>
 #include <string>
+
+#if defined(_WIN32)
 #include <system_error>
+#endif
 
 // Wrap everything in namespace llvm so that programs can link with llvm and
 // their own version of the unicode libraries.
index 1d7594e..a6f8ebe 100644 (file)
 
 // FIXME: vector is used because that's what clang uses for subtarget feature
 // lists, but SmallVector would probably be better
-#include "llvm/ADT/Triple.h"
 #include "llvm/Support/RISCVISAInfo.h"
 #include <vector>
 
 namespace llvm {
+
 class StringRef;
+template <typename T> class SmallVectorImpl;
+class Triple;
 
 // Target specific information in their own namespaces.
 // (ARM/AArch64/X86 are declared in ARM/AArch64/X86TargetParser.h)
index aecff12..868dd28 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <future>
 
-#include <atomic>
 #include <condition_variable>
 #include <functional>
 #include <memory>
index bfa3e23..6f5db64 100644 (file)
 #define LLVM_SUPPORT_X86TARGETPARSER_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 
 namespace llvm {
+template <typename T> class SmallVectorImpl;;
 class StringRef;
 
 namespace X86 {
index 6652907..b7e41f6 100644 (file)
@@ -20,7 +20,6 @@
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/SourceMgr.h"
-#include "llvm/Support/VersionTuple.h"
 #include "llvm/Support/YAMLParser.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
@@ -34,6 +33,9 @@
 #include <vector>
 
 namespace llvm {
+
+class VersionTuple;
+
 namespace yaml {
 
 enum class NodeKind : uint8_t {
index f22523f..9b8f686 100644 (file)
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/BinaryStreamError.h"
-#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
 
index b6aaf37..2ee3074 100644 (file)
@@ -9,7 +9,6 @@
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ExitCodes.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/ThreadLocal.h"
 #include <mutex>
 #include <setjmp.h>
 
+#if !defined(_MSC_VER) && !defined(_WIN32)
+#include "llvm/Support/ExitCodes.h"
+#endif
+
 using namespace llvm;
 
 namespace {
index 1a14ed2..489b8d1 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
-#include <cmath>
 #include <cstdint>
 #include <cstdlib>
 #include <cstring>
index 7192fb1..bf34a24 100644 (file)
@@ -18,7 +18,6 @@
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/SmallVectorMemoryBuffer.h"
index c14ddbe..0105cd2 100644 (file)
@@ -14,7 +14,7 @@
 #include "llvm/Support/TargetParser.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/ARMBuildAttributes.h"
+#include "llvm/ADT/Triple.h"
 
 using namespace llvm;
 using namespace AMDGPU;
index 6eec368..bf25849 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Threading.h"
-#include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
 
index b79d520..939427d 100644 (file)
@@ -18,6 +18,7 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/VersionTuple.h"
 #include "llvm/Support/YAMLParser.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>