Skip to content

[NFC] Cleanup in Support headers. #104825

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed

Conversation

dfukalov
Copy link
Collaborator

Remove unused directly includes and forward declarations in Support headers.

Remove unused directly includes and forward declarations in Support headers.
@dfukalov
Copy link
Collaborator Author

For reference: compile-time-tracker run with the change (please check the instructions:u for "clang build" at the bottom).
See also the per-file breakdown.

@llvmbot
Copy link
Member

llvmbot commented Aug 19, 2024

@llvm/pr-subscribers-bolt
@llvm/pr-subscribers-lld-elf
@llvm/pr-subscribers-llvm-analysis
@llvm/pr-subscribers-llvm-support
@llvm/pr-subscribers-tools-llvm-mca
@llvm/pr-subscribers-lld-macho
@llvm/pr-subscribers-lld-wasm
@llvm/pr-subscribers-mlgo
@llvm/pr-subscribers-llvm-adt

@llvm/pr-subscribers-clang-format

Author: Daniil Fukalov (dfukalov)

Changes

Remove unused directly includes and forward declarations in Support headers.


Patch is 48.61 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/104825.diff

102 Files Affected:

  • (modified) clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp (+1)
  • (modified) clang/lib/Format/Format.cpp (+1)
  • (modified) clang/lib/Format/FormatTokenSource.h (+1)
  • (modified) clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (+1)
  • (modified) clang/tools/driver/driver.cpp (+1)
  • (modified) clang/unittests/Format/MacroCallReconstructorTest.cpp (+1)
  • (modified) lld/ELF/Writer.cpp (+1)
  • (modified) lld/MachO/BPSectionOrderer.cpp (+1)
  • (modified) lld/MachO/Dwarf.cpp (+1)
  • (modified) lld/MachO/SectionPriorities.cpp (+1)
  • (modified) lld/wasm/WriterUtils.h (+1)
  • (modified) llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h (-1)
  • (modified) llvm/include/llvm/Support/Atomic.h (+1-1)
  • (modified) llvm/include/llvm/Support/BalancedPartitioning.h (+2-1)
  • (modified) llvm/include/llvm/Support/BinaryStreamReader.h (-1)
  • (modified) llvm/include/llvm/Support/BranchProbability.h (-1)
  • (modified) llvm/include/llvm/Support/CRC.h (+1-1)
  • (modified) llvm/include/llvm/Support/CachePruning.h (+3-1)
  • (modified) llvm/include/llvm/Support/Casting.h (-1)
  • (modified) llvm/include/llvm/Support/Chrono.h (+1-4)
  • (modified) llvm/include/llvm/Support/CommandLine.h (-4)
  • (modified) llvm/include/llvm/Support/Compression.h (+4-2)
  • (modified) llvm/include/llvm/Support/ConvertEBCDIC.h (+3-1)
  • (modified) llvm/include/llvm/Support/DataExtractor.h (-1)
  • (modified) llvm/include/llvm/Support/DebugCounter.h (+2-2)
  • (modified) llvm/include/llvm/Support/ELFAttributeParser.h (-1)
  • (modified) llvm/include/llvm/Support/Error.h (-2)
  • (modified) llvm/include/llvm/Support/ErrorHandling.h (-2)
  • (modified) llvm/include/llvm/Support/ExponentialBackoff.h (-2)
  • (modified) llvm/include/llvm/Support/FileOutputBuffer.h (-1)
  • (modified) llvm/include/llvm/Support/FileUtilities.h (-2)
  • (modified) llvm/include/llvm/Support/FormatVariadic.h (-1)
  • (modified) llvm/include/llvm/Support/LineIterator.h (-1)
  • (modified) llvm/include/llvm/Support/LockFileManager.h (-1)
  • (modified) llvm/include/llvm/Support/MathExtras.h (-1)
  • (modified) llvm/include/llvm/Support/Memory.h (-1)
  • (modified) llvm/include/llvm/Support/OptimizedStructLayout.h (+2-1)
  • (modified) llvm/include/llvm/Support/PGOOptions.h (+1-1)
  • (modified) llvm/include/llvm/Support/Path.h (-1)
  • (modified) llvm/include/llvm/Support/PrettyStackTrace.h (-1)
  • (modified) llvm/include/llvm/Support/Process.h (-1)
  • (modified) llvm/include/llvm/Support/RandomNumberGenerator.h (-2)
  • (modified) llvm/include/llvm/Support/ScopedPrinter.h (-1)
  • (modified) llvm/include/llvm/Support/SpecialCaseList.h (-1)
  • (modified) llvm/include/llvm/Support/ThreadPool.h (+1-2)
  • (modified) llvm/include/llvm/Support/Threading.h (-1)
  • (modified) llvm/include/llvm/Support/Timer.h (-1)
  • (modified) llvm/include/llvm/Support/TypeSize.h (-1)
  • (modified) llvm/include/llvm/Support/VirtualFileSystem.h (-1)
  • (modified) llvm/include/llvm/Support/Watchdog.h (-2)
  • (modified) llvm/include/llvm/Support/WithColor.h (-1)
  • (modified) llvm/include/llvm/Support/raw_ostream.h (-1)
  • (modified) llvm/include/llvm/Testing/ADT/StringMap.h (-1)
  • (modified) llvm/lib/Analysis/AliasAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILMetadataAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILResource.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineOrder.cpp (+1)
  • (modified) llvm/lib/Analysis/InteractiveModelRunner.cpp (+1)
  • (modified) llvm/lib/Analysis/ReplayInlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/StackSafetyAnalysis.cpp (+1)
  • (modified) llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp (+1)
  • (modified) llvm/lib/CodeGen/MachineCFGPrinter.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/ReplaceWithVeclib.cpp (+1)
  • (modified) llvm/lib/DebugInfo/BTF/BTFParser.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp (+1)
  • (modified) llvm/lib/FileCheck/FileCheck.cpp (+1)
  • (modified) llvm/lib/MCA/Stages/InOrderIssueStage.cpp (+1)
  • (modified) llvm/lib/Object/WasmObjectFile.cpp (+1)
  • (modified) llvm/lib/Passes/StandardInstrumentations.cpp (+1)
  • (modified) llvm/lib/Support/CachePruning.cpp (+1)
  • (modified) llvm/lib/Support/ConvertEBCDIC.cpp (+1)
  • (modified) llvm/lib/Support/CrashRecoveryContext.cpp (+1)
  • (modified) llvm/lib/Support/DebugCounter.cpp (+1)
  • (modified) llvm/lib/Support/OptimizedStructLayout.cpp (+1)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+1)
  • (modified) llvm/lib/Support/Unix/Process.inc (+1-3)
  • (modified) llvm/lib/Support/Unix/Unix.h (+1-1)
  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/GlobalDCE.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/Debugify.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+2-1)
  • (modified) llvm/tools/llvm-dwarfdump/SectionSizes.cpp (+1)
  • (modified) llvm/tools/llvm-dwarfdump/Statistics.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/MachODump.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/SourcePrinter.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+1)
  • (modified) llvm/tools/llvm-rc/llvm-rc.cpp (+1)
  • (modified) llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp (+1)
  • (modified) llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp (+1)
  • (modified) llvm/unittests/Analysis/LazyCallGraphTest.cpp (+1)
  • (modified) llvm/unittests/Support/OptimizedStructLayoutTest.cpp (+1)
  • (modified) llvm/unittests/TargetParser/Host.cpp (+1)
  • (modified) llvm/unittests/Testing/ADT/StringMapTest.cpp (+1)
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index 3a1f745d9ed777..9fc4d9582824eb 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include <memory>
 #include <utility>
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 97fac41cdd3008..77cc0ef9074a01 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -23,6 +23,7 @@
 #include "UsingDeclarationsSorter.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-formatter"
 
diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h
index 8f00e5f4582c68..246ddd2ec7e581 100644
--- a/clang/lib/Format/FormatTokenSource.h
+++ b/clang/lib/Format/FormatTokenSource.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
 
 #include "UnwrappedLineParser.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-token-source"
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index b89a6e2588c987..640dac63b32957 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -28,6 +28,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include <limits>
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 83b5bbb71f5212..101489954d0ad0 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/LLVMDriver.h"
diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index b4ee8d0e37efa8..4d67c4abf84ba2 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -4,6 +4,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4c0b4df5bea170..b61d7a5f11647c 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/BLAKE3.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/TimeProfiler.h"
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 568843d72bbb50..5877f6374ce7dc 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/BalancedPartitioning.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/xxhash.h"
diff --git a/lld/MachO/Dwarf.cpp b/lld/MachO/Dwarf.cpp
index 47dc51e6196d12..cc817b621570c6 100644
--- a/lld/MachO/Dwarf.cpp
+++ b/lld/MachO/Dwarf.cpp
@@ -10,6 +10,7 @@
 #include "InputFiles.h"
 #include "InputSection.h"
 #include "OutputSegment.h"
+#include "llvm/ADT/StringSwitch.h"
 
 #include <memory>
 
diff --git a/lld/MachO/SectionPriorities.cpp b/lld/MachO/SectionPriorities.cpp
index 69c301d8ff8a71..3d77f7f7dc36f2 100644
--- a/lld/MachO/SectionPriorities.cpp
+++ b/lld/MachO/SectionPriorities.cpp
@@ -23,6 +23,7 @@
 #include "lld/Common/ErrorHandler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h
index 2be79d1d86e977..0cdca7d978ac56 100644
--- a/lld/wasm/WriterUtils.h
+++ b/lld/wasm/WriterUtils.h
@@ -12,6 +12,7 @@
 #include "lld/Common/LLVM.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Object/Wasm.h"
+#include "llvm/Support/Debug.h"
 
 namespace lld {
 namespace wasm {
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index 4aa922635c374e..06e62b0fc424a9 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -59,7 +59,6 @@ extern llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
 extern llvm::cl::opt<double> IterativeBFIPrecision;
 
 class BranchProbabilityInfo;
-class Function;
 class Loop;
 class LoopInfo;
 class MachineBasicBlock;
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index a8445fddc1a855..44a521dc21f883 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -17,7 +17,7 @@
 #ifndef LLVM_SUPPORT_ATOMIC_H
 #define LLVM_SUPPORT_ATOMIC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 // Windows will at times define MemoryFence.
 #ifdef MemoryFence
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 539d157343fbe3..240ccb268b8341 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -39,7 +39,6 @@
 #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
-#include "raw_ostream.h"
 #include "llvm/ADT/ArrayRef.h"
 
 #include <atomic>
@@ -51,6 +50,8 @@
 namespace llvm {
 
 class ThreadPoolInterface;
+class raw_ostream;
+
 /// A function with a set of utility nodes where it is beneficial to order two
 /// functions close together if they have similar utility nodes
 class BPFunctionNode {
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03af..43e76fc753358b 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -11,7 +11,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Alignment.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/ConvertUTF.h"
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d415..d901ff2a68c6df 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h
index 210890ae06d47c..a055835d835870 100644
--- a/llvm/include/llvm/Support/CRC.h
+++ b/llvm/include/llvm/Support/CRC.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_SUPPORT_CRC_H
 #define LLVM_SUPPORT_CRC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 namespace llvm {
 template <typename T> class ArrayRef;
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f9..e2d2f2fdd4cf0d 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,13 +14,15 @@
 #ifndef LLVM_SUPPORT_CACHEPRUNING_H
 #define LLVM_SUPPORT_CACHEPRUNING_H
 
-#include "llvm/Support/MemoryBuffer.h"
 #include <chrono>
+#include <memory>
 #include <optional>
+#include <vector>
 
 namespace llvm {
 
 template <typename T> class Expected;
+class MemoryBuffer;
 class StringRef;
 
 /// Policy for the pruneCache() function. A default constructed
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index 14a32ccd0e0dc9..43625961d54335 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_CASTING_H
 #define LLVM_SUPPORT_CASTING_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <memory>
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a5..84e602ab7252fc 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -9,8 +9,7 @@
 #ifndef LLVM_SUPPORT_CHRONO_H
 #define LLVM_SUPPORT_CHRONO_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormatProviders.h"
+#include "llvm/Support/FormatVariadicDetails.h"
 
 #include <chrono>
 #include <ctime>
@@ -18,8 +17,6 @@
 
 namespace llvm {
 
-class raw_ostream;
-
 namespace sys {
 
 /// A time point on the system clock. This is provided for two reasons:
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb205..c8d95c7b221267 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -20,7 +20,6 @@
 #define LLVM_SUPPORT_COMMANDLINE_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -31,7 +30,6 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <climits>
 #include <cstddef>
 #include <functional>
 #include <initializer_list>
@@ -45,8 +43,6 @@ namespace vfs {
 class FileSystem;
 }
 
-class StringSaver;
-
 /// This namespace contains all of the command line option processing machinery.
 /// It is intentionally a short name to make qualified usage concise.
 namespace cl {
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 2a8da9e96d356f..b4294b06e8c679 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -13,10 +13,12 @@
 #ifndef LLVM_SUPPORT_COMPRESSION_H
 #define LLVM_SUPPORT_COMPRESSION_H
 
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
+template <typename T> class ArrayRef;
 template <typename T> class SmallVectorImpl;
 class Error;
 
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index ea761b31e022b7..aa01acc65f7e69 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -13,11 +13,13 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <system_error>
 
 namespace llvm {
+
+template <typename T> class SmallVectorImpl;
+
 namespace ConverterEBCDIC {
 std::error_code convertToEBCDIC(StringRef Source,
                                 SmallVectorImpl<char> &Result);
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd6..e44576f4700947 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_DATAEXTRACTOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99d..3321331da3a324 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -42,16 +42,16 @@
 #ifndef LLVM_SUPPORT_DEBUGCOUNTER_H
 #define LLVM_SUPPORT_DEBUGCOUNTER_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/UniqueVector.h"
-#include "llvm/Support/Debug.h"
 #include <string>
 
 namespace llvm {
 
 class raw_ostream;
+template <typename T> class ArrayRef;
 
 class DebugCounter {
 public:
diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h
index ffb92468fb37eb..9cd21dfffa5cca 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -18,7 +18,6 @@
 #include <unordered_map>
 
 namespace llvm {
-class StringRef;
 class ScopedPrinter;
 
 class ELFAttributeParser {
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7d..786f3bf5b281e0 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -17,14 +17,12 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <cstdint>
 #include <cstdlib>
 #include <functional>
 #include <memory>
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 9c8e3448f3a03e..7fd9f63a5cf9c5 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -14,8 +14,6 @@
 #ifndef LLVM_SUPPORT_ERRORHANDLING_H
 #define LLVM_SUPPORT_ERRORHANDLING_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
   class StringRef;
   class Twine;
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a6..43cc0f2229a97d 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -12,8 +12,6 @@
 #ifndef LLVM_EXPONENTIALBACKOFF_H
 #define LLVM_EXPONENTIALBACKOFF_H
 
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Error.h"
 #include <chrono>
 #include <random>
 
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115dbf..d7783eaffab5a4 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d631708..de0f79185bd03f 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -18,8 +18,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 
-#include <system_error>
-
 namespace llvm {
 
   /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index 595f2cf559a428..65dbcad430300d 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -26,7 +26,6 @@
 #define LLVM_SUPPORT_FORMATVARIADIC_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a65..16c2d7be2fa453 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_LINEITERATOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include <iterator>
 #include <optional>
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929f..f15ee27e58367a 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -14,7 +14,6 @@
 #include <utility> // for std::pair
 
 namespace llvm {
-class StringRef;
 
 /// Class that manages the creation of a lock file to aid
 /// implicit coordination between different processes.
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4b..be1e9c4419fc28 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_MATHEXTRAS_H
 
 #include "llvm/ADT/bit.h"
-#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <climits>
 #include <cstdint>
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index d7d60371d315f0..bfb13c5bb3ac10 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_MEMORY_H
 #define LLVM_SUPPORT_MEMORY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beba..699cc75cf26d35 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -36,11 +36,12 @@
 #define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 
 #include "llvm/Support/Alignment.h"
-#include "llvm/ADT/ArrayRef.h"
 #include <utility>
 
 namespace llvm {
 
+template <typename T> class MutableArrayRef;
+
 /// A field in a structure.
 struct OptimizedStructLayoutField {
   /// A special value for Offset indicating that the field can be moved
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index de981abf187058..981b5057ec5f67 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -15,7 +15,7 @@
 #define LLVM_SUPPORT_PGOOPTIONS_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/Error.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81b..28d9b633213efb 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -17,7 +17,6 @@
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/DataTypes.h"
 #include <iterator>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index ac25cffde051c9..602470bc00bece 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -16,7 +16,6 @@
 #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class raw_ostream;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 83f1fcd8b2abca..1b544542acc8fc 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,7 +25,6 @@
 #define LLVM_SUPPORT_PROCESS_H
 
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Program.h"
 #include <optional>
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41f..de0ce870498e98 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -15,8 +15,6 @@
 #ifndef LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 #define LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h" // Needed for uint64_t on Wind...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Aug 19, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Daniil Fukalov (dfukalov)

Changes

Remove unused directly includes and forward declarations in Support headers.


Patch is 48.61 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/104825.diff

102 Files Affected:

  • (modified) clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp (+1)
  • (modified) clang/lib/Format/Format.cpp (+1)
  • (modified) clang/lib/Format/FormatTokenSource.h (+1)
  • (modified) clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (+1)
  • (modified) clang/tools/driver/driver.cpp (+1)
  • (modified) clang/unittests/Format/MacroCallReconstructorTest.cpp (+1)
  • (modified) lld/ELF/Writer.cpp (+1)
  • (modified) lld/MachO/BPSectionOrderer.cpp (+1)
  • (modified) lld/MachO/Dwarf.cpp (+1)
  • (modified) lld/MachO/SectionPriorities.cpp (+1)
  • (modified) lld/wasm/WriterUtils.h (+1)
  • (modified) llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h (-1)
  • (modified) llvm/include/llvm/Support/Atomic.h (+1-1)
  • (modified) llvm/include/llvm/Support/BalancedPartitioning.h (+2-1)
  • (modified) llvm/include/llvm/Support/BinaryStreamReader.h (-1)
  • (modified) llvm/include/llvm/Support/BranchProbability.h (-1)
  • (modified) llvm/include/llvm/Support/CRC.h (+1-1)
  • (modified) llvm/include/llvm/Support/CachePruning.h (+3-1)
  • (modified) llvm/include/llvm/Support/Casting.h (-1)
  • (modified) llvm/include/llvm/Support/Chrono.h (+1-4)
  • (modified) llvm/include/llvm/Support/CommandLine.h (-4)
  • (modified) llvm/include/llvm/Support/Compression.h (+4-2)
  • (modified) llvm/include/llvm/Support/ConvertEBCDIC.h (+3-1)
  • (modified) llvm/include/llvm/Support/DataExtractor.h (-1)
  • (modified) llvm/include/llvm/Support/DebugCounter.h (+2-2)
  • (modified) llvm/include/llvm/Support/ELFAttributeParser.h (-1)
  • (modified) llvm/include/llvm/Support/Error.h (-2)
  • (modified) llvm/include/llvm/Support/ErrorHandling.h (-2)
  • (modified) llvm/include/llvm/Support/ExponentialBackoff.h (-2)
  • (modified) llvm/include/llvm/Support/FileOutputBuffer.h (-1)
  • (modified) llvm/include/llvm/Support/FileUtilities.h (-2)
  • (modified) llvm/include/llvm/Support/FormatVariadic.h (-1)
  • (modified) llvm/include/llvm/Support/LineIterator.h (-1)
  • (modified) llvm/include/llvm/Support/LockFileManager.h (-1)
  • (modified) llvm/include/llvm/Support/MathExtras.h (-1)
  • (modified) llvm/include/llvm/Support/Memory.h (-1)
  • (modified) llvm/include/llvm/Support/OptimizedStructLayout.h (+2-1)
  • (modified) llvm/include/llvm/Support/PGOOptions.h (+1-1)
  • (modified) llvm/include/llvm/Support/Path.h (-1)
  • (modified) llvm/include/llvm/Support/PrettyStackTrace.h (-1)
  • (modified) llvm/include/llvm/Support/Process.h (-1)
  • (modified) llvm/include/llvm/Support/RandomNumberGenerator.h (-2)
  • (modified) llvm/include/llvm/Support/ScopedPrinter.h (-1)
  • (modified) llvm/include/llvm/Support/SpecialCaseList.h (-1)
  • (modified) llvm/include/llvm/Support/ThreadPool.h (+1-2)
  • (modified) llvm/include/llvm/Support/Threading.h (-1)
  • (modified) llvm/include/llvm/Support/Timer.h (-1)
  • (modified) llvm/include/llvm/Support/TypeSize.h (-1)
  • (modified) llvm/include/llvm/Support/VirtualFileSystem.h (-1)
  • (modified) llvm/include/llvm/Support/Watchdog.h (-2)
  • (modified) llvm/include/llvm/Support/WithColor.h (-1)
  • (modified) llvm/include/llvm/Support/raw_ostream.h (-1)
  • (modified) llvm/include/llvm/Testing/ADT/StringMap.h (-1)
  • (modified) llvm/lib/Analysis/AliasAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILMetadataAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILResource.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineOrder.cpp (+1)
  • (modified) llvm/lib/Analysis/InteractiveModelRunner.cpp (+1)
  • (modified) llvm/lib/Analysis/ReplayInlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/StackSafetyAnalysis.cpp (+1)
  • (modified) llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp (+1)
  • (modified) llvm/lib/CodeGen/MachineCFGPrinter.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/ReplaceWithVeclib.cpp (+1)
  • (modified) llvm/lib/DebugInfo/BTF/BTFParser.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp (+1)
  • (modified) llvm/lib/FileCheck/FileCheck.cpp (+1)
  • (modified) llvm/lib/MCA/Stages/InOrderIssueStage.cpp (+1)
  • (modified) llvm/lib/Object/WasmObjectFile.cpp (+1)
  • (modified) llvm/lib/Passes/StandardInstrumentations.cpp (+1)
  • (modified) llvm/lib/Support/CachePruning.cpp (+1)
  • (modified) llvm/lib/Support/ConvertEBCDIC.cpp (+1)
  • (modified) llvm/lib/Support/CrashRecoveryContext.cpp (+1)
  • (modified) llvm/lib/Support/DebugCounter.cpp (+1)
  • (modified) llvm/lib/Support/OptimizedStructLayout.cpp (+1)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+1)
  • (modified) llvm/lib/Support/Unix/Process.inc (+1-3)
  • (modified) llvm/lib/Support/Unix/Unix.h (+1-1)
  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/GlobalDCE.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/Debugify.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+2-1)
  • (modified) llvm/tools/llvm-dwarfdump/SectionSizes.cpp (+1)
  • (modified) llvm/tools/llvm-dwarfdump/Statistics.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/MachODump.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/SourcePrinter.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+1)
  • (modified) llvm/tools/llvm-rc/llvm-rc.cpp (+1)
  • (modified) llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp (+1)
  • (modified) llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp (+1)
  • (modified) llvm/unittests/Analysis/LazyCallGraphTest.cpp (+1)
  • (modified) llvm/unittests/Support/OptimizedStructLayoutTest.cpp (+1)
  • (modified) llvm/unittests/TargetParser/Host.cpp (+1)
  • (modified) llvm/unittests/Testing/ADT/StringMapTest.cpp (+1)
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index 3a1f745d9ed777..9fc4d9582824eb 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include <memory>
 #include <utility>
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 97fac41cdd3008..77cc0ef9074a01 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -23,6 +23,7 @@
 #include "UsingDeclarationsSorter.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-formatter"
 
diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h
index 8f00e5f4582c68..246ddd2ec7e581 100644
--- a/clang/lib/Format/FormatTokenSource.h
+++ b/clang/lib/Format/FormatTokenSource.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
 
 #include "UnwrappedLineParser.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-token-source"
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index b89a6e2588c987..640dac63b32957 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -28,6 +28,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include <limits>
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 83b5bbb71f5212..101489954d0ad0 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/LLVMDriver.h"
diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index b4ee8d0e37efa8..4d67c4abf84ba2 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -4,6 +4,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4c0b4df5bea170..b61d7a5f11647c 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/BLAKE3.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/TimeProfiler.h"
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 568843d72bbb50..5877f6374ce7dc 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/BalancedPartitioning.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/xxhash.h"
diff --git a/lld/MachO/Dwarf.cpp b/lld/MachO/Dwarf.cpp
index 47dc51e6196d12..cc817b621570c6 100644
--- a/lld/MachO/Dwarf.cpp
+++ b/lld/MachO/Dwarf.cpp
@@ -10,6 +10,7 @@
 #include "InputFiles.h"
 #include "InputSection.h"
 #include "OutputSegment.h"
+#include "llvm/ADT/StringSwitch.h"
 
 #include <memory>
 
diff --git a/lld/MachO/SectionPriorities.cpp b/lld/MachO/SectionPriorities.cpp
index 69c301d8ff8a71..3d77f7f7dc36f2 100644
--- a/lld/MachO/SectionPriorities.cpp
+++ b/lld/MachO/SectionPriorities.cpp
@@ -23,6 +23,7 @@
 #include "lld/Common/ErrorHandler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h
index 2be79d1d86e977..0cdca7d978ac56 100644
--- a/lld/wasm/WriterUtils.h
+++ b/lld/wasm/WriterUtils.h
@@ -12,6 +12,7 @@
 #include "lld/Common/LLVM.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Object/Wasm.h"
+#include "llvm/Support/Debug.h"
 
 namespace lld {
 namespace wasm {
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index 4aa922635c374e..06e62b0fc424a9 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -59,7 +59,6 @@ extern llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
 extern llvm::cl::opt<double> IterativeBFIPrecision;
 
 class BranchProbabilityInfo;
-class Function;
 class Loop;
 class LoopInfo;
 class MachineBasicBlock;
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index a8445fddc1a855..44a521dc21f883 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -17,7 +17,7 @@
 #ifndef LLVM_SUPPORT_ATOMIC_H
 #define LLVM_SUPPORT_ATOMIC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 // Windows will at times define MemoryFence.
 #ifdef MemoryFence
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 539d157343fbe3..240ccb268b8341 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -39,7 +39,6 @@
 #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
-#include "raw_ostream.h"
 #include "llvm/ADT/ArrayRef.h"
 
 #include <atomic>
@@ -51,6 +50,8 @@
 namespace llvm {
 
 class ThreadPoolInterface;
+class raw_ostream;
+
 /// A function with a set of utility nodes where it is beneficial to order two
 /// functions close together if they have similar utility nodes
 class BPFunctionNode {
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03af..43e76fc753358b 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -11,7 +11,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Alignment.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/ConvertUTF.h"
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d415..d901ff2a68c6df 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h
index 210890ae06d47c..a055835d835870 100644
--- a/llvm/include/llvm/Support/CRC.h
+++ b/llvm/include/llvm/Support/CRC.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_SUPPORT_CRC_H
 #define LLVM_SUPPORT_CRC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 namespace llvm {
 template <typename T> class ArrayRef;
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f9..e2d2f2fdd4cf0d 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,13 +14,15 @@
 #ifndef LLVM_SUPPORT_CACHEPRUNING_H
 #define LLVM_SUPPORT_CACHEPRUNING_H
 
-#include "llvm/Support/MemoryBuffer.h"
 #include <chrono>
+#include <memory>
 #include <optional>
+#include <vector>
 
 namespace llvm {
 
 template <typename T> class Expected;
+class MemoryBuffer;
 class StringRef;
 
 /// Policy for the pruneCache() function. A default constructed
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index 14a32ccd0e0dc9..43625961d54335 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_CASTING_H
 #define LLVM_SUPPORT_CASTING_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <memory>
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a5..84e602ab7252fc 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -9,8 +9,7 @@
 #ifndef LLVM_SUPPORT_CHRONO_H
 #define LLVM_SUPPORT_CHRONO_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormatProviders.h"
+#include "llvm/Support/FormatVariadicDetails.h"
 
 #include <chrono>
 #include <ctime>
@@ -18,8 +17,6 @@
 
 namespace llvm {
 
-class raw_ostream;
-
 namespace sys {
 
 /// A time point on the system clock. This is provided for two reasons:
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb205..c8d95c7b221267 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -20,7 +20,6 @@
 #define LLVM_SUPPORT_COMMANDLINE_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -31,7 +30,6 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <climits>
 #include <cstddef>
 #include <functional>
 #include <initializer_list>
@@ -45,8 +43,6 @@ namespace vfs {
 class FileSystem;
 }
 
-class StringSaver;
-
 /// This namespace contains all of the command line option processing machinery.
 /// It is intentionally a short name to make qualified usage concise.
 namespace cl {
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 2a8da9e96d356f..b4294b06e8c679 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -13,10 +13,12 @@
 #ifndef LLVM_SUPPORT_COMPRESSION_H
 #define LLVM_SUPPORT_COMPRESSION_H
 
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
+template <typename T> class ArrayRef;
 template <typename T> class SmallVectorImpl;
 class Error;
 
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index ea761b31e022b7..aa01acc65f7e69 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -13,11 +13,13 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <system_error>
 
 namespace llvm {
+
+template <typename T> class SmallVectorImpl;
+
 namespace ConverterEBCDIC {
 std::error_code convertToEBCDIC(StringRef Source,
                                 SmallVectorImpl<char> &Result);
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd6..e44576f4700947 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_DATAEXTRACTOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99d..3321331da3a324 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -42,16 +42,16 @@
 #ifndef LLVM_SUPPORT_DEBUGCOUNTER_H
 #define LLVM_SUPPORT_DEBUGCOUNTER_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/UniqueVector.h"
-#include "llvm/Support/Debug.h"
 #include <string>
 
 namespace llvm {
 
 class raw_ostream;
+template <typename T> class ArrayRef;
 
 class DebugCounter {
 public:
diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h
index ffb92468fb37eb..9cd21dfffa5cca 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -18,7 +18,6 @@
 #include <unordered_map>
 
 namespace llvm {
-class StringRef;
 class ScopedPrinter;
 
 class ELFAttributeParser {
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7d..786f3bf5b281e0 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -17,14 +17,12 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <cstdint>
 #include <cstdlib>
 #include <functional>
 #include <memory>
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 9c8e3448f3a03e..7fd9f63a5cf9c5 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -14,8 +14,6 @@
 #ifndef LLVM_SUPPORT_ERRORHANDLING_H
 #define LLVM_SUPPORT_ERRORHANDLING_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
   class StringRef;
   class Twine;
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a6..43cc0f2229a97d 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -12,8 +12,6 @@
 #ifndef LLVM_EXPONENTIALBACKOFF_H
 #define LLVM_EXPONENTIALBACKOFF_H
 
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Error.h"
 #include <chrono>
 #include <random>
 
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115dbf..d7783eaffab5a4 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d631708..de0f79185bd03f 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -18,8 +18,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 
-#include <system_error>
-
 namespace llvm {
 
   /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index 595f2cf559a428..65dbcad430300d 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -26,7 +26,6 @@
 #define LLVM_SUPPORT_FORMATVARIADIC_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a65..16c2d7be2fa453 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_LINEITERATOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include <iterator>
 #include <optional>
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929f..f15ee27e58367a 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -14,7 +14,6 @@
 #include <utility> // for std::pair
 
 namespace llvm {
-class StringRef;
 
 /// Class that manages the creation of a lock file to aid
 /// implicit coordination between different processes.
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4b..be1e9c4419fc28 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_MATHEXTRAS_H
 
 #include "llvm/ADT/bit.h"
-#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <climits>
 #include <cstdint>
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index d7d60371d315f0..bfb13c5bb3ac10 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_MEMORY_H
 #define LLVM_SUPPORT_MEMORY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beba..699cc75cf26d35 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -36,11 +36,12 @@
 #define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 
 #include "llvm/Support/Alignment.h"
-#include "llvm/ADT/ArrayRef.h"
 #include <utility>
 
 namespace llvm {
 
+template <typename T> class MutableArrayRef;
+
 /// A field in a structure.
 struct OptimizedStructLayoutField {
   /// A special value for Offset indicating that the field can be moved
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index de981abf187058..981b5057ec5f67 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -15,7 +15,7 @@
 #define LLVM_SUPPORT_PGOOPTIONS_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/Error.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81b..28d9b633213efb 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -17,7 +17,6 @@
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/DataTypes.h"
 #include <iterator>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index ac25cffde051c9..602470bc00bece 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -16,7 +16,6 @@
 #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class raw_ostream;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 83f1fcd8b2abca..1b544542acc8fc 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,7 +25,6 @@
 #define LLVM_SUPPORT_PROCESS_H
 
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Program.h"
 #include <optional>
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41f..de0ce870498e98 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -15,8 +15,6 @@
 #ifndef LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 #define LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h" // Needed for uint64_t on Wind...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Aug 19, 2024

@llvm/pr-subscribers-lld

Author: Daniil Fukalov (dfukalov)

Changes

Remove unused directly includes and forward declarations in Support headers.


Patch is 48.41 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/104825.diff

102 Files Affected:

  • (modified) clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp (+1)
  • (modified) clang/lib/Format/Format.cpp (+1)
  • (modified) clang/lib/Format/FormatTokenSource.h (+1)
  • (modified) clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (+1)
  • (modified) clang/tools/driver/driver.cpp (+1)
  • (modified) clang/unittests/Format/MacroCallReconstructorTest.cpp (+1)
  • (modified) lld/ELF/Writer.cpp (+1)
  • (modified) lld/MachO/BPSectionOrderer.cpp (+1)
  • (modified) lld/MachO/Dwarf.cpp (+1)
  • (modified) lld/MachO/SectionPriorities.cpp (+1)
  • (modified) lld/wasm/WriterUtils.h (+1)
  • (modified) llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h (-1)
  • (modified) llvm/include/llvm/Support/Atomic.h (+1-1)
  • (modified) llvm/include/llvm/Support/BalancedPartitioning.h (+2-1)
  • (modified) llvm/include/llvm/Support/BinaryStreamReader.h (-1)
  • (modified) llvm/include/llvm/Support/BranchProbability.h (-1)
  • (modified) llvm/include/llvm/Support/CRC.h (+1-1)
  • (modified) llvm/include/llvm/Support/CachePruning.h (+3-1)
  • (modified) llvm/include/llvm/Support/Casting.h (-1)
  • (modified) llvm/include/llvm/Support/Chrono.h (+1-4)
  • (modified) llvm/include/llvm/Support/CommandLine.h (-4)
  • (modified) llvm/include/llvm/Support/Compression.h (+4-2)
  • (modified) llvm/include/llvm/Support/ConvertEBCDIC.h (+3-1)
  • (modified) llvm/include/llvm/Support/DataExtractor.h (-1)
  • (modified) llvm/include/llvm/Support/DebugCounter.h (+2-2)
  • (modified) llvm/include/llvm/Support/ELFAttributeParser.h (-1)
  • (modified) llvm/include/llvm/Support/Error.h (-2)
  • (modified) llvm/include/llvm/Support/ErrorHandling.h (-2)
  • (modified) llvm/include/llvm/Support/ExponentialBackoff.h (-2)
  • (modified) llvm/include/llvm/Support/FileOutputBuffer.h (-1)
  • (modified) llvm/include/llvm/Support/FileUtilities.h (-2)
  • (modified) llvm/include/llvm/Support/FormatVariadic.h (-1)
  • (modified) llvm/include/llvm/Support/LineIterator.h (-1)
  • (modified) llvm/include/llvm/Support/LockFileManager.h (-1)
  • (modified) llvm/include/llvm/Support/MathExtras.h (-1)
  • (modified) llvm/include/llvm/Support/Memory.h (-1)
  • (modified) llvm/include/llvm/Support/OptimizedStructLayout.h (+2-1)
  • (modified) llvm/include/llvm/Support/PGOOptions.h (+1-1)
  • (modified) llvm/include/llvm/Support/Path.h (-1)
  • (modified) llvm/include/llvm/Support/PrettyStackTrace.h (-1)
  • (modified) llvm/include/llvm/Support/Process.h (-1)
  • (modified) llvm/include/llvm/Support/RandomNumberGenerator.h (-2)
  • (modified) llvm/include/llvm/Support/ScopedPrinter.h (-1)
  • (modified) llvm/include/llvm/Support/SpecialCaseList.h (-1)
  • (modified) llvm/include/llvm/Support/ThreadPool.h (+1-2)
  • (modified) llvm/include/llvm/Support/Threading.h (-1)
  • (modified) llvm/include/llvm/Support/Timer.h (-1)
  • (modified) llvm/include/llvm/Support/TypeSize.h (-1)
  • (modified) llvm/include/llvm/Support/VirtualFileSystem.h (-1)
  • (modified) llvm/include/llvm/Support/Watchdog.h (-2)
  • (modified) llvm/include/llvm/Support/WithColor.h (-1)
  • (modified) llvm/include/llvm/Support/raw_ostream.h (-1)
  • (modified) llvm/include/llvm/Testing/ADT/StringMap.h (-1)
  • (modified) llvm/lib/Analysis/AliasAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILMetadataAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILResource.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineOrder.cpp (+1)
  • (modified) llvm/lib/Analysis/InteractiveModelRunner.cpp (+1)
  • (modified) llvm/lib/Analysis/ReplayInlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/StackSafetyAnalysis.cpp (+1)
  • (modified) llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp (+1)
  • (modified) llvm/lib/CodeGen/MachineCFGPrinter.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/ReplaceWithVeclib.cpp (+1)
  • (modified) llvm/lib/DebugInfo/BTF/BTFParser.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp (+1)
  • (modified) llvm/lib/FileCheck/FileCheck.cpp (+1)
  • (modified) llvm/lib/MCA/Stages/InOrderIssueStage.cpp (+1)
  • (modified) llvm/lib/Object/WasmObjectFile.cpp (+1)
  • (modified) llvm/lib/Passes/StandardInstrumentations.cpp (+1)
  • (modified) llvm/lib/Support/CachePruning.cpp (+1)
  • (modified) llvm/lib/Support/ConvertEBCDIC.cpp (+1)
  • (modified) llvm/lib/Support/CrashRecoveryContext.cpp (+1)
  • (modified) llvm/lib/Support/DebugCounter.cpp (+1)
  • (modified) llvm/lib/Support/OptimizedStructLayout.cpp (+1)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+1)
  • (modified) llvm/lib/Support/Unix/Process.inc (+1-3)
  • (modified) llvm/lib/Support/Unix/Unix.h (+1-1)
  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/GlobalDCE.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/Debugify.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+2-1)
  • (modified) llvm/tools/llvm-dwarfdump/SectionSizes.cpp (+1)
  • (modified) llvm/tools/llvm-dwarfdump/Statistics.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/MachODump.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/SourcePrinter.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+1)
  • (modified) llvm/tools/llvm-rc/llvm-rc.cpp (+1)
  • (modified) llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp (+1)
  • (modified) llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp (+1)
  • (modified) llvm/unittests/Analysis/LazyCallGraphTest.cpp (+1)
  • (modified) llvm/unittests/Support/OptimizedStructLayoutTest.cpp (+1)
  • (modified) llvm/unittests/TargetParser/Host.cpp (+1)
  • (modified) llvm/unittests/Testing/ADT/StringMapTest.cpp (+1)
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index 3a1f745d9ed77..9fc4d9582824e 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include <memory>
 #include <utility>
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 97fac41cdd300..77cc0ef9074a0 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -23,6 +23,7 @@
 #include "UsingDeclarationsSorter.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-formatter"
 
diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h
index 8f00e5f4582c6..246ddd2ec7e58 100644
--- a/clang/lib/Format/FormatTokenSource.h
+++ b/clang/lib/Format/FormatTokenSource.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
 
 #include "UnwrappedLineParser.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-token-source"
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index b89a6e2588c98..640dac63b3295 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -28,6 +28,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include <limits>
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 83b5bbb71f521..101489954d0ad 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/LLVMDriver.h"
diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index b4ee8d0e37efa..4d67c4abf84ba 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -4,6 +4,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4c0b4df5bea17..b61d7a5f11647 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/BLAKE3.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/TimeProfiler.h"
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 568843d72bbb5..5877f6374ce7d 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/BalancedPartitioning.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/xxhash.h"
diff --git a/lld/MachO/Dwarf.cpp b/lld/MachO/Dwarf.cpp
index 47dc51e6196d1..cc817b621570c 100644
--- a/lld/MachO/Dwarf.cpp
+++ b/lld/MachO/Dwarf.cpp
@@ -10,6 +10,7 @@
 #include "InputFiles.h"
 #include "InputSection.h"
 #include "OutputSegment.h"
+#include "llvm/ADT/StringSwitch.h"
 
 #include <memory>
 
diff --git a/lld/MachO/SectionPriorities.cpp b/lld/MachO/SectionPriorities.cpp
index 69c301d8ff8a7..3d77f7f7dc36f 100644
--- a/lld/MachO/SectionPriorities.cpp
+++ b/lld/MachO/SectionPriorities.cpp
@@ -23,6 +23,7 @@
 #include "lld/Common/ErrorHandler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h
index 2be79d1d86e97..0cdca7d978ac5 100644
--- a/lld/wasm/WriterUtils.h
+++ b/lld/wasm/WriterUtils.h
@@ -12,6 +12,7 @@
 #include "lld/Common/LLVM.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Object/Wasm.h"
+#include "llvm/Support/Debug.h"
 
 namespace lld {
 namespace wasm {
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index 4aa922635c374..06e62b0fc424a 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -59,7 +59,6 @@ extern llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
 extern llvm::cl::opt<double> IterativeBFIPrecision;
 
 class BranchProbabilityInfo;
-class Function;
 class Loop;
 class LoopInfo;
 class MachineBasicBlock;
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index a8445fddc1a85..44a521dc21f88 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -17,7 +17,7 @@
 #ifndef LLVM_SUPPORT_ATOMIC_H
 #define LLVM_SUPPORT_ATOMIC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 // Windows will at times define MemoryFence.
 #ifdef MemoryFence
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 539d157343fbe..240ccb268b834 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -39,7 +39,6 @@
 #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
-#include "raw_ostream.h"
 #include "llvm/ADT/ArrayRef.h"
 
 #include <atomic>
@@ -51,6 +50,8 @@
 namespace llvm {
 
 class ThreadPoolInterface;
+class raw_ostream;
+
 /// A function with a set of utility nodes where it is beneficial to order two
 /// functions close together if they have similar utility nodes
 class BPFunctionNode {
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03a..43e76fc753358 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -11,7 +11,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Alignment.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/ConvertUTF.h"
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d41..d901ff2a68c6d 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h
index 210890ae06d47..a055835d83587 100644
--- a/llvm/include/llvm/Support/CRC.h
+++ b/llvm/include/llvm/Support/CRC.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_SUPPORT_CRC_H
 #define LLVM_SUPPORT_CRC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 namespace llvm {
 template <typename T> class ArrayRef;
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f..e2d2f2fdd4cf0 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,13 +14,15 @@
 #ifndef LLVM_SUPPORT_CACHEPRUNING_H
 #define LLVM_SUPPORT_CACHEPRUNING_H
 
-#include "llvm/Support/MemoryBuffer.h"
 #include <chrono>
+#include <memory>
 #include <optional>
+#include <vector>
 
 namespace llvm {
 
 template <typename T> class Expected;
+class MemoryBuffer;
 class StringRef;
 
 /// Policy for the pruneCache() function. A default constructed
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index 14a32ccd0e0dc..43625961d5433 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_CASTING_H
 #define LLVM_SUPPORT_CASTING_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <memory>
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a..84e602ab7252f 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -9,8 +9,7 @@
 #ifndef LLVM_SUPPORT_CHRONO_H
 #define LLVM_SUPPORT_CHRONO_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormatProviders.h"
+#include "llvm/Support/FormatVariadicDetails.h"
 
 #include <chrono>
 #include <ctime>
@@ -18,8 +17,6 @@
 
 namespace llvm {
 
-class raw_ostream;
-
 namespace sys {
 
 /// A time point on the system clock. This is provided for two reasons:
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb20..c8d95c7b22126 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -20,7 +20,6 @@
 #define LLVM_SUPPORT_COMMANDLINE_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -31,7 +30,6 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <climits>
 #include <cstddef>
 #include <functional>
 #include <initializer_list>
@@ -45,8 +43,6 @@ namespace vfs {
 class FileSystem;
 }
 
-class StringSaver;
-
 /// This namespace contains all of the command line option processing machinery.
 /// It is intentionally a short name to make qualified usage concise.
 namespace cl {
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 2a8da9e96d356..b4294b06e8c67 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -13,10 +13,12 @@
 #ifndef LLVM_SUPPORT_COMPRESSION_H
 #define LLVM_SUPPORT_COMPRESSION_H
 
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
+template <typename T> class ArrayRef;
 template <typename T> class SmallVectorImpl;
 class Error;
 
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index ea761b31e022b..aa01acc65f7e6 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -13,11 +13,13 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <system_error>
 
 namespace llvm {
+
+template <typename T> class SmallVectorImpl;
+
 namespace ConverterEBCDIC {
 std::error_code convertToEBCDIC(StringRef Source,
                                 SmallVectorImpl<char> &Result);
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd..e44576f470094 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_DATAEXTRACTOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99..3321331da3a32 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -42,16 +42,16 @@
 #ifndef LLVM_SUPPORT_DEBUGCOUNTER_H
 #define LLVM_SUPPORT_DEBUGCOUNTER_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/UniqueVector.h"
-#include "llvm/Support/Debug.h"
 #include <string>
 
 namespace llvm {
 
 class raw_ostream;
+template <typename T> class ArrayRef;
 
 class DebugCounter {
 public:
diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h
index ffb92468fb37e..9cd21dfffa5cc 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -18,7 +18,6 @@
 #include <unordered_map>
 
 namespace llvm {
-class StringRef;
 class ScopedPrinter;
 
 class ELFAttributeParser {
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7..786f3bf5b281e 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -17,14 +17,12 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <cstdint>
 #include <cstdlib>
 #include <functional>
 #include <memory>
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 9c8e3448f3a03..7fd9f63a5cf9c 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -14,8 +14,6 @@
 #ifndef LLVM_SUPPORT_ERRORHANDLING_H
 #define LLVM_SUPPORT_ERRORHANDLING_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
   class StringRef;
   class Twine;
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a..43cc0f2229a97 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -12,8 +12,6 @@
 #ifndef LLVM_EXPONENTIALBACKOFF_H
 #define LLVM_EXPONENTIALBACKOFF_H
 
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Error.h"
 #include <chrono>
 #include <random>
 
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115db..d7783eaffab5a 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d63170..de0f79185bd03 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -18,8 +18,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 
-#include <system_error>
-
 namespace llvm {
 
   /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index 595f2cf559a42..65dbcad430300 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -26,7 +26,6 @@
 #define LLVM_SUPPORT_FORMATVARIADIC_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a6..16c2d7be2fa45 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_LINEITERATOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include <iterator>
 #include <optional>
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929..f15ee27e58367 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -14,7 +14,6 @@
 #include <utility> // for std::pair
 
 namespace llvm {
-class StringRef;
 
 /// Class that manages the creation of a lock file to aid
 /// implicit coordination between different processes.
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4..be1e9c4419fc2 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_MATHEXTRAS_H
 
 #include "llvm/ADT/bit.h"
-#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <climits>
 #include <cstdint>
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index d7d60371d315f..bfb13c5bb3ac1 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_MEMORY_H
 #define LLVM_SUPPORT_MEMORY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beb..699cc75cf26d3 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -36,11 +36,12 @@
 #define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 
 #include "llvm/Support/Alignment.h"
-#include "llvm/ADT/ArrayRef.h"
 #include <utility>
 
 namespace llvm {
 
+template <typename T> class MutableArrayRef;
+
 /// A field in a structure.
 struct OptimizedStructLayoutField {
   /// A special value for Offset indicating that the field can be moved
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index de981abf18705..981b5057ec5f6 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -15,7 +15,7 @@
 #define LLVM_SUPPORT_PGOOPTIONS_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/Error.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81..28d9b633213ef 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -17,7 +17,6 @@
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/DataTypes.h"
 #include <iterator>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index ac25cffde051c..602470bc00bec 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -16,7 +16,6 @@
 #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class raw_ostream;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 83f1fcd8b2abc..1b544542acc8f 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,7 +25,6 @@
 #define LLVM_SUPPORT_PROCESS_H
 
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Program.h"
 #include <optional>
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41..de0ce870498e9 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -15,8 +15,6 @@
 #ifndef LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 #define LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h" // Needed for uint64_t on Windows.
 #include <random>
 #include <system_error>
 
diff --git a/llvm/include/llvm/Su...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Aug 19, 2024

@llvm/pr-subscribers-backend-directx

Author: Daniil Fukalov (dfukalov)

Changes

Remove unused directly includes and forward declarations in Support headers.


Patch is 48.41 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/104825.diff

102 Files Affected:

  • (modified) clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp (+1)
  • (modified) clang/lib/Format/Format.cpp (+1)
  • (modified) clang/lib/Format/FormatTokenSource.h (+1)
  • (modified) clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp (+1)
  • (modified) clang/tools/driver/driver.cpp (+1)
  • (modified) clang/unittests/Format/MacroCallReconstructorTest.cpp (+1)
  • (modified) lld/ELF/Writer.cpp (+1)
  • (modified) lld/MachO/BPSectionOrderer.cpp (+1)
  • (modified) lld/MachO/Dwarf.cpp (+1)
  • (modified) lld/MachO/SectionPriorities.cpp (+1)
  • (modified) lld/wasm/WriterUtils.h (+1)
  • (modified) llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h (-1)
  • (modified) llvm/include/llvm/Support/Atomic.h (+1-1)
  • (modified) llvm/include/llvm/Support/BalancedPartitioning.h (+2-1)
  • (modified) llvm/include/llvm/Support/BinaryStreamReader.h (-1)
  • (modified) llvm/include/llvm/Support/BranchProbability.h (-1)
  • (modified) llvm/include/llvm/Support/CRC.h (+1-1)
  • (modified) llvm/include/llvm/Support/CachePruning.h (+3-1)
  • (modified) llvm/include/llvm/Support/Casting.h (-1)
  • (modified) llvm/include/llvm/Support/Chrono.h (+1-4)
  • (modified) llvm/include/llvm/Support/CommandLine.h (-4)
  • (modified) llvm/include/llvm/Support/Compression.h (+4-2)
  • (modified) llvm/include/llvm/Support/ConvertEBCDIC.h (+3-1)
  • (modified) llvm/include/llvm/Support/DataExtractor.h (-1)
  • (modified) llvm/include/llvm/Support/DebugCounter.h (+2-2)
  • (modified) llvm/include/llvm/Support/ELFAttributeParser.h (-1)
  • (modified) llvm/include/llvm/Support/Error.h (-2)
  • (modified) llvm/include/llvm/Support/ErrorHandling.h (-2)
  • (modified) llvm/include/llvm/Support/ExponentialBackoff.h (-2)
  • (modified) llvm/include/llvm/Support/FileOutputBuffer.h (-1)
  • (modified) llvm/include/llvm/Support/FileUtilities.h (-2)
  • (modified) llvm/include/llvm/Support/FormatVariadic.h (-1)
  • (modified) llvm/include/llvm/Support/LineIterator.h (-1)
  • (modified) llvm/include/llvm/Support/LockFileManager.h (-1)
  • (modified) llvm/include/llvm/Support/MathExtras.h (-1)
  • (modified) llvm/include/llvm/Support/Memory.h (-1)
  • (modified) llvm/include/llvm/Support/OptimizedStructLayout.h (+2-1)
  • (modified) llvm/include/llvm/Support/PGOOptions.h (+1-1)
  • (modified) llvm/include/llvm/Support/Path.h (-1)
  • (modified) llvm/include/llvm/Support/PrettyStackTrace.h (-1)
  • (modified) llvm/include/llvm/Support/Process.h (-1)
  • (modified) llvm/include/llvm/Support/RandomNumberGenerator.h (-2)
  • (modified) llvm/include/llvm/Support/ScopedPrinter.h (-1)
  • (modified) llvm/include/llvm/Support/SpecialCaseList.h (-1)
  • (modified) llvm/include/llvm/Support/ThreadPool.h (+1-2)
  • (modified) llvm/include/llvm/Support/Threading.h (-1)
  • (modified) llvm/include/llvm/Support/Timer.h (-1)
  • (modified) llvm/include/llvm/Support/TypeSize.h (-1)
  • (modified) llvm/include/llvm/Support/VirtualFileSystem.h (-1)
  • (modified) llvm/include/llvm/Support/Watchdog.h (-2)
  • (modified) llvm/include/llvm/Support/WithColor.h (-1)
  • (modified) llvm/include/llvm/Support/raw_ostream.h (-1)
  • (modified) llvm/include/llvm/Testing/ADT/StringMap.h (-1)
  • (modified) llvm/lib/Analysis/AliasAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILMetadataAnalysis.cpp (+1)
  • (modified) llvm/lib/Analysis/DXILResource.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/InlineOrder.cpp (+1)
  • (modified) llvm/lib/Analysis/InteractiveModelRunner.cpp (+1)
  • (modified) llvm/lib/Analysis/ReplayInlineAdvisor.cpp (+1)
  • (modified) llvm/lib/Analysis/StackSafetyAnalysis.cpp (+1)
  • (modified) llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp (+1)
  • (modified) llvm/lib/CodeGen/MachineCFGPrinter.cpp (+1-1)
  • (modified) llvm/lib/CodeGen/ReplaceWithVeclib.cpp (+1)
  • (modified) llvm/lib/DebugInfo/BTF/BTFParser.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp (+1)
  • (modified) llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp (+1)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp (+1)
  • (modified) llvm/lib/FileCheck/FileCheck.cpp (+1)
  • (modified) llvm/lib/MCA/Stages/InOrderIssueStage.cpp (+1)
  • (modified) llvm/lib/Object/WasmObjectFile.cpp (+1)
  • (modified) llvm/lib/Passes/StandardInstrumentations.cpp (+1)
  • (modified) llvm/lib/Support/CachePruning.cpp (+1)
  • (modified) llvm/lib/Support/ConvertEBCDIC.cpp (+1)
  • (modified) llvm/lib/Support/CrashRecoveryContext.cpp (+1)
  • (modified) llvm/lib/Support/DebugCounter.cpp (+1)
  • (modified) llvm/lib/Support/OptimizedStructLayout.cpp (+1)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+1)
  • (modified) llvm/lib/Support/Unix/Process.inc (+1-3)
  • (modified) llvm/lib/Support/Unix/Unix.h (+1-1)
  • (modified) llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/GlobalDCE.cpp (+1)
  • (modified) llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/Debugify.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/InjectTLIMappings.cpp (+1)
  • (modified) llvm/lib/Transforms/Utils/ModuleUtils.cpp (+2-1)
  • (modified) llvm/tools/llvm-dwarfdump/SectionSizes.cpp (+1)
  • (modified) llvm/tools/llvm-dwarfdump/Statistics.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/MachODump.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/SourcePrinter.cpp (+1)
  • (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+1)
  • (modified) llvm/tools/llvm-rc/llvm-rc.cpp (+1)
  • (modified) llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp (+1)
  • (modified) llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp (+1)
  • (modified) llvm/unittests/Analysis/LazyCallGraphTest.cpp (+1)
  • (modified) llvm/unittests/Support/OptimizedStructLayoutTest.cpp (+1)
  • (modified) llvm/unittests/TargetParser/Host.cpp (+1)
  • (modified) llvm/unittests/Testing/ADT/StringMapTest.cpp (+1)
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index 3a1f745d9ed77..9fc4d9582824e 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include <memory>
 #include <utility>
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 97fac41cdd300..77cc0ef9074a0 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -23,6 +23,7 @@
 #include "UsingDeclarationsSorter.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-formatter"
 
diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h
index 8f00e5f4582c6..246ddd2ec7e58 100644
--- a/clang/lib/Format/FormatTokenSource.h
+++ b/clang/lib/Format/FormatTokenSource.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
 
 #include "UnwrappedLineParser.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-token-source"
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index b89a6e2588c98..640dac63b3295 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -28,6 +28,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include <limits>
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 83b5bbb71f521..101489954d0ad 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/LLVMDriver.h"
diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index b4ee8d0e37efa..4d67c4abf84ba 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -4,6 +4,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4c0b4df5bea17..b61d7a5f11647 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/BLAKE3.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/TimeProfiler.h"
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 568843d72bbb5..5877f6374ce7d 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/BalancedPartitioning.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/xxhash.h"
diff --git a/lld/MachO/Dwarf.cpp b/lld/MachO/Dwarf.cpp
index 47dc51e6196d1..cc817b621570c 100644
--- a/lld/MachO/Dwarf.cpp
+++ b/lld/MachO/Dwarf.cpp
@@ -10,6 +10,7 @@
 #include "InputFiles.h"
 #include "InputSection.h"
 #include "OutputSegment.h"
+#include "llvm/ADT/StringSwitch.h"
 
 #include <memory>
 
diff --git a/lld/MachO/SectionPriorities.cpp b/lld/MachO/SectionPriorities.cpp
index 69c301d8ff8a7..3d77f7f7dc36f 100644
--- a/lld/MachO/SectionPriorities.cpp
+++ b/lld/MachO/SectionPriorities.cpp
@@ -23,6 +23,7 @@
 #include "lld/Common/ErrorHandler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h
index 2be79d1d86e97..0cdca7d978ac5 100644
--- a/lld/wasm/WriterUtils.h
+++ b/lld/wasm/WriterUtils.h
@@ -12,6 +12,7 @@
 #include "lld/Common/LLVM.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Object/Wasm.h"
+#include "llvm/Support/Debug.h"
 
 namespace lld {
 namespace wasm {
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index 4aa922635c374..06e62b0fc424a 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -59,7 +59,6 @@ extern llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
 extern llvm::cl::opt<double> IterativeBFIPrecision;
 
 class BranchProbabilityInfo;
-class Function;
 class Loop;
 class LoopInfo;
 class MachineBasicBlock;
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index a8445fddc1a85..44a521dc21f88 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -17,7 +17,7 @@
 #ifndef LLVM_SUPPORT_ATOMIC_H
 #define LLVM_SUPPORT_ATOMIC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 // Windows will at times define MemoryFence.
 #ifdef MemoryFence
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 539d157343fbe..240ccb268b834 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -39,7 +39,6 @@
 #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
-#include "raw_ostream.h"
 #include "llvm/ADT/ArrayRef.h"
 
 #include <atomic>
@@ -51,6 +50,8 @@
 namespace llvm {
 
 class ThreadPoolInterface;
+class raw_ostream;
+
 /// A function with a set of utility nodes where it is beneficial to order two
 /// functions close together if they have similar utility nodes
 class BPFunctionNode {
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03a..43e76fc753358 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -11,7 +11,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Alignment.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/ConvertUTF.h"
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d41..d901ff2a68c6d 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h
index 210890ae06d47..a055835d83587 100644
--- a/llvm/include/llvm/Support/CRC.h
+++ b/llvm/include/llvm/Support/CRC.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_SUPPORT_CRC_H
 #define LLVM_SUPPORT_CRC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 namespace llvm {
 template <typename T> class ArrayRef;
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f..e2d2f2fdd4cf0 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,13 +14,15 @@
 #ifndef LLVM_SUPPORT_CACHEPRUNING_H
 #define LLVM_SUPPORT_CACHEPRUNING_H
 
-#include "llvm/Support/MemoryBuffer.h"
 #include <chrono>
+#include <memory>
 #include <optional>
+#include <vector>
 
 namespace llvm {
 
 template <typename T> class Expected;
+class MemoryBuffer;
 class StringRef;
 
 /// Policy for the pruneCache() function. A default constructed
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index 14a32ccd0e0dc..43625961d5433 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_CASTING_H
 #define LLVM_SUPPORT_CASTING_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <memory>
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a..84e602ab7252f 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -9,8 +9,7 @@
 #ifndef LLVM_SUPPORT_CHRONO_H
 #define LLVM_SUPPORT_CHRONO_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormatProviders.h"
+#include "llvm/Support/FormatVariadicDetails.h"
 
 #include <chrono>
 #include <ctime>
@@ -18,8 +17,6 @@
 
 namespace llvm {
 
-class raw_ostream;
-
 namespace sys {
 
 /// A time point on the system clock. This is provided for two reasons:
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb20..c8d95c7b22126 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -20,7 +20,6 @@
 #define LLVM_SUPPORT_COMMANDLINE_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -31,7 +30,6 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <climits>
 #include <cstddef>
 #include <functional>
 #include <initializer_list>
@@ -45,8 +43,6 @@ namespace vfs {
 class FileSystem;
 }
 
-class StringSaver;
-
 /// This namespace contains all of the command line option processing machinery.
 /// It is intentionally a short name to make qualified usage concise.
 namespace cl {
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 2a8da9e96d356..b4294b06e8c67 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -13,10 +13,12 @@
 #ifndef LLVM_SUPPORT_COMPRESSION_H
 #define LLVM_SUPPORT_COMPRESSION_H
 
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
+template <typename T> class ArrayRef;
 template <typename T> class SmallVectorImpl;
 class Error;
 
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index ea761b31e022b..aa01acc65f7e6 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -13,11 +13,13 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <system_error>
 
 namespace llvm {
+
+template <typename T> class SmallVectorImpl;
+
 namespace ConverterEBCDIC {
 std::error_code convertToEBCDIC(StringRef Source,
                                 SmallVectorImpl<char> &Result);
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd..e44576f470094 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_DATAEXTRACTOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99..3321331da3a32 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -42,16 +42,16 @@
 #ifndef LLVM_SUPPORT_DEBUGCOUNTER_H
 #define LLVM_SUPPORT_DEBUGCOUNTER_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/UniqueVector.h"
-#include "llvm/Support/Debug.h"
 #include <string>
 
 namespace llvm {
 
 class raw_ostream;
+template <typename T> class ArrayRef;
 
 class DebugCounter {
 public:
diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h
index ffb92468fb37e..9cd21dfffa5cc 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -18,7 +18,6 @@
 #include <unordered_map>
 
 namespace llvm {
-class StringRef;
 class ScopedPrinter;
 
 class ELFAttributeParser {
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7..786f3bf5b281e 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -17,14 +17,12 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <cstdint>
 #include <cstdlib>
 #include <functional>
 #include <memory>
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 9c8e3448f3a03..7fd9f63a5cf9c 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -14,8 +14,6 @@
 #ifndef LLVM_SUPPORT_ERRORHANDLING_H
 #define LLVM_SUPPORT_ERRORHANDLING_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
   class StringRef;
   class Twine;
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a..43cc0f2229a97 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -12,8 +12,6 @@
 #ifndef LLVM_EXPONENTIALBACKOFF_H
 #define LLVM_EXPONENTIALBACKOFF_H
 
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Error.h"
 #include <chrono>
 #include <random>
 
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115db..d7783eaffab5a 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d63170..de0f79185bd03 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -18,8 +18,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 
-#include <system_error>
-
 namespace llvm {
 
   /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index 595f2cf559a42..65dbcad430300 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -26,7 +26,6 @@
 #define LLVM_SUPPORT_FORMATVARIADIC_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a6..16c2d7be2fa45 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_LINEITERATOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include <iterator>
 #include <optional>
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929..f15ee27e58367 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -14,7 +14,6 @@
 #include <utility> // for std::pair
 
 namespace llvm {
-class StringRef;
 
 /// Class that manages the creation of a lock file to aid
 /// implicit coordination between different processes.
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4..be1e9c4419fc2 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_MATHEXTRAS_H
 
 #include "llvm/ADT/bit.h"
-#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <climits>
 #include <cstdint>
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index d7d60371d315f..bfb13c5bb3ac1 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_MEMORY_H
 #define LLVM_SUPPORT_MEMORY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beb..699cc75cf26d3 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -36,11 +36,12 @@
 #define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 
 #include "llvm/Support/Alignment.h"
-#include "llvm/ADT/ArrayRef.h"
 #include <utility>
 
 namespace llvm {
 
+template <typename T> class MutableArrayRef;
+
 /// A field in a structure.
 struct OptimizedStructLayoutField {
   /// A special value for Offset indicating that the field can be moved
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index de981abf18705..981b5057ec5f6 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -15,7 +15,7 @@
 #define LLVM_SUPPORT_PGOOPTIONS_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/Error.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81..28d9b633213ef 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -17,7 +17,6 @@
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/DataTypes.h"
 #include <iterator>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index ac25cffde051c..602470bc00bec 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -16,7 +16,6 @@
 #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class raw_ostream;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 83f1fcd8b2abc..1b544542acc8f 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,7 +25,6 @@
 #define LLVM_SUPPORT_PROCESS_H
 
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Program.h"
 #include <optional>
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41..de0ce870498e9 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -15,8 +15,6 @@
 #ifndef LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 #define LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h" // Needed for uint64_t on Windows.
 #include <random>
 #include <system_error>
 
diff --git a/llvm/include/llvm/Su...
[truncated]

@nikic
Copy link
Contributor

nikic commented Aug 20, 2024

For reference: compile-time-tracker run with the change (please check the instructions:u for "clang build" at the bottom). See also the per-file breakdown.

This shows compile-time regressions -- that really shouldn't happen for include changes.

@nikic
Copy link
Contributor

nikic commented Aug 20, 2024

Best guess on how this could happen: Something depends on a no longer included macro via #if defined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants