[Mlir-commits] [clang] [llvm] [mlir] [NFC][IWYU] Update includes in Support lib with IWYU. (PR #102306)

Daniil Fukalov llvmlistbot at llvm.org
Wed Aug 7 05:32:47 PDT 2024


https://github.com/dfukalov updated https://github.com/llvm/llvm-project/pull/102306

>From 309408ba81cb65fa7794226e04dae3e8a2eaa8dd Mon Sep 17 00:00:00 2001
From: dfukalov <1671137+dfukalov at users.noreply.github.com>
Date: Wed, 7 Aug 2024 02:09:07 +0200
Subject: [PATCH] [NFC][IWYU] Update includes in Support lib with IWYU.

Update according IWYU include files in lib/ADT and both include and cpp files in lib/Support.
Firstly processed the sources by scripts from https://github.com/include-what-you-use/include-what-you-use,
then fixed some miscorrections, also taking into account clangd suggestions.
---
 clang/lib/Driver/ToolChains/SPIRV.cpp         |  1 +
 llvm/include/llvm/ADT/APFixedPoint.h          |  8 ++++++-
 llvm/include/llvm/ADT/APFloat.h               | 15 +++++++++++--
 llvm/include/llvm/ADT/APInt.h                 |  2 ++
 llvm/include/llvm/ADT/APSInt.h                |  9 ++++++++
 llvm/include/llvm/ADT/DynamicAPInt.h          | 10 ++++++++-
 llvm/include/llvm/ADT/FloatingPointMode.h     |  4 ++++
 llvm/include/llvm/ADT/FoldingSet.h            |  2 ++
 llvm/include/llvm/ADT/IntEqClasses.h          |  1 +
 llvm/include/llvm/ADT/IntervalMap.h           |  1 +
 llvm/include/llvm/ADT/SlowDynamicAPInt.h      |  5 ++++-
 llvm/include/llvm/ADT/SmallPtrSet.h           |  2 +-
 llvm/include/llvm/ADT/SmallVector.h           |  2 +-
 llvm/include/llvm/ADT/Statistic.h             |  3 ++-
 llvm/include/llvm/ADT/StringExtras.h          |  8 +++++++
 llvm/include/llvm/ADT/StringMap.h             |  8 +++++++
 llvm/include/llvm/ADT/StringRef.h             |  1 +
 llvm/include/llvm/ADT/Twine.h                 |  1 +
 .../include/llvm/Support/ARMAttributeParser.h |  1 +
 llvm/include/llvm/Support/ARMWinEH.h          |  4 ++++
 llvm/include/llvm/Support/Atomic.h            |  2 +-
 .../llvm/Support/BalancedPartitioning.h       |  8 +++++--
 llvm/include/llvm/Support/Base64.h            |  2 ++
 llvm/include/llvm/Support/BinaryStreamError.h |  4 +++-
 .../include/llvm/Support/BinaryStreamReader.h |  7 ++++++-
 llvm/include/llvm/Support/BinaryStreamRef.h   |  6 ++++++
 .../include/llvm/Support/BinaryStreamWriter.h |  2 ++
 llvm/include/llvm/Support/BranchProbability.h |  2 +-
 llvm/include/llvm/Support/CRC.h               |  2 +-
 .../llvm/Support/CSKYAttributeParser.h        |  5 +++++
 llvm/include/llvm/Support/CachePruning.h      |  5 ++++-
 llvm/include/llvm/Support/Caching.h           |  8 +++++++
 llvm/include/llvm/Support/Chrono.h            | 13 +++++++-----
 llvm/include/llvm/Support/CodeGenCoverage.h   |  3 +++
 llvm/include/llvm/Support/CommandLine.h       |  8 +++----
 llvm/include/llvm/Support/Compression.h       |  6 ++++--
 llvm/include/llvm/Support/ConvertEBCDIC.h     |  3 ++-
 llvm/include/llvm/Support/DJB.h               |  1 +
 llvm/include/llvm/Support/DataExtractor.h     |  6 +++++-
 llvm/include/llvm/Support/DebugCounter.h      |  7 ++++++-
 .../include/llvm/Support/ELFAttributeParser.h |  6 ++++--
 llvm/include/llvm/Support/Error.h             |  3 ++-
 .../include/llvm/Support/ExponentialBackoff.h |  3 +--
 llvm/include/llvm/Support/FileCollector.h     |  8 +++++++
 llvm/include/llvm/Support/FileOutputBuffer.h  |  5 ++++-
 llvm/include/llvm/Support/FileUtilities.h     |  6 ++++--
 llvm/include/llvm/Support/FormatVariadic.h    |  1 -
 .../llvm/Support/FormatVariadicDetails.h      |  1 -
 llvm/include/llvm/Support/FormattedStream.h   |  3 +++
 llvm/include/llvm/Support/GlobPattern.h       |  1 +
 llvm/include/llvm/Support/GraphWriter.h       |  1 +
 .../llvm/Support/HexagonAttributeParser.h     |  5 +++++
 llvm/include/llvm/Support/InstructionCost.h   |  1 +
 llvm/include/llvm/Support/JSON.h              | 21 +++++++++++++++++++
 llvm/include/llvm/Support/KnownBits.h         |  3 +++
 llvm/include/llvm/Support/LEB128.h            |  2 ++
 llvm/include/llvm/Support/LineIterator.h      |  3 ++-
 llvm/include/llvm/Support/LockFileManager.h   |  3 ++-
 llvm/include/llvm/Support/MD5.h               |  3 +++
 .../llvm/Support/MSP430AttributeParser.h      |  5 +++++
 llvm/include/llvm/Support/MathExtras.h        |  1 -
 llvm/include/llvm/Support/Memory.h            |  2 +-
 llvm/include/llvm/Support/MemoryBuffer.h      |  1 +
 llvm/include/llvm/Support/MemoryBufferRef.h   |  1 +
 llvm/include/llvm/Support/NativeFormatting.h  |  1 +
 .../llvm/Support/OptimizedStructLayout.h      |  4 +++-
 llvm/include/llvm/Support/PGOOptions.h        |  2 +-
 llvm/include/llvm/Support/Parallel.h          | 10 ++++++++-
 llvm/include/llvm/Support/Path.h              |  6 +++++-
 llvm/include/llvm/Support/PrettyStackTrace.h  |  1 -
 llvm/include/llvm/Support/Process.h           |  5 ++++-
 llvm/include/llvm/Support/Program.h           |  9 +++++++-
 .../llvm/Support/RISCVAttributeParser.h       |  5 +++++
 .../llvm/Support/RandomNumberGenerator.h      |  3 +--
 llvm/include/llvm/Support/ScaledNumber.h      |  3 +++
 llvm/include/llvm/Support/ScopedPrinter.h     |  6 +++++-
 llvm/include/llvm/Support/SourceMgr.h         | 11 ++++++++++
 llvm/include/llvm/Support/SpecialCaseList.h   |  4 +++-
 llvm/include/llvm/Support/StringSaver.h       |  1 +
 llvm/include/llvm/Support/SuffixTree.h        |  2 ++
 llvm/include/llvm/Support/TarWriter.h         |  2 ++
 llvm/include/llvm/Support/ThreadPool.h        | 10 ++++-----
 llvm/include/llvm/Support/Threading.h         |  5 +++--
 llvm/include/llvm/Support/TimeProfiler.h      |  2 ++
 llvm/include/llvm/Support/Timer.h             |  3 ++-
 llvm/include/llvm/Support/ToolOutputFile.h    |  8 +++++++
 llvm/include/llvm/Support/TypeSize.h          |  3 +--
 llvm/include/llvm/Support/Unicode.h           |  3 +++
 llvm/include/llvm/Support/VersionTuple.h      |  1 +
 llvm/include/llvm/Support/VirtualFileSystem.h | 14 ++++++++-----
 llvm/include/llvm/Support/Watchdog.h          |  2 --
 llvm/include/llvm/Support/WithColor.h         |  2 +-
 llvm/include/llvm/Support/YAMLParser.h        |  1 +
 llvm/include/llvm/Support/YAMLTraits.h        | 12 +++++++++++
 .../llvm/Support/circular_raw_ostream.h       |  2 ++
 llvm/include/llvm/Support/raw_os_ostream.h    |  2 ++
 llvm/include/llvm/Support/raw_ostream.h       |  8 ++++++-
 llvm/include/llvm/Support/raw_socket_stream.h |  6 +++++-
 llvm/include/llvm/Support/xxhash.h            |  1 +
 .../DWARF/DWARFLocationExpression.cpp         |  1 +
 llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp    |  2 ++
 llvm/lib/FileCheck/FileCheck.cpp              |  3 ++-
 llvm/lib/Support/AMDGPUMetadata.cpp           |  2 ++
 llvm/lib/Support/APFixedPoint.cpp             |  4 +++-
 llvm/lib/Support/APFloat.cpp                  |  8 +++++--
 llvm/lib/Support/APInt.cpp                    |  6 +++++-
 llvm/lib/Support/APSInt.cpp                   |  1 +
 llvm/lib/Support/ARMAttributeParser.cpp       | 11 ++++++++++
 llvm/lib/Support/ARMBuildAttrs.cpp            |  5 +----
 llvm/lib/Support/BalancedPartitioning.cpp     |  9 ++++++++
 llvm/lib/Support/Base64.cpp                   |  2 ++
 llvm/lib/Support/BinaryStreamReader.cpp       | 10 ++++++++-
 llvm/lib/Support/BinaryStreamRef.cpp          |  4 ++++
 llvm/lib/Support/BinaryStreamWriter.cpp       |  9 +++++++-
 llvm/lib/Support/BranchProbability.cpp        |  2 +-
 llvm/lib/Support/BuryPointer.cpp              |  1 +
 llvm/lib/Support/CRC.cpp                      |  4 ++--
 llvm/lib/Support/CSKYAttributeParser.cpp      |  5 +++++
 llvm/lib/Support/CachePruning.cpp             | 17 ++++++++++++---
 llvm/lib/Support/Caching.cpp                  |  5 ++++-
 llvm/lib/Support/Chrono.cpp                   |  1 +
 llvm/lib/Support/CodeGenCoverage.cpp          |  8 ++++++-
 llvm/lib/Support/CommandLine.cpp              | 15 +++++++++++--
 llvm/lib/Support/Compression.cpp              |  5 ++++-
 llvm/lib/Support/ConvertEBCDIC.cpp            |  3 +++
 llvm/lib/Support/ConvertUTFWrapper.cpp        |  6 +++++-
 llvm/lib/Support/CrashRecoveryContext.cpp     |  6 +++++-
 llvm/lib/Support/DAGDeltaAlgorithm.cpp        |  2 +-
 llvm/lib/Support/DJB.cpp                      |  4 +++-
 llvm/lib/Support/DataExtractor.cpp            |  4 ++++
 llvm/lib/Support/Debug.cpp                    |  6 ++++--
 llvm/lib/Support/DebugCounter.cpp             |  8 +++++--
 llvm/lib/Support/DivisionByConstantInfo.cpp   |  2 ++
 llvm/lib/Support/DynamicAPInt.cpp             |  1 +
 llvm/lib/Support/DynamicLibrary.cpp           |  6 ++++++
 llvm/lib/Support/ELFAttributeParser.cpp       |  6 ++++++
 llvm/lib/Support/ELFAttributes.cpp            |  1 +
 llvm/lib/Support/Errno.cpp                    |  1 +
 llvm/lib/Support/Error.cpp                    |  1 +
 llvm/lib/Support/ErrorHandling.cpp            | 10 ++++-----
 llvm/lib/Support/ExponentialBackoff.cpp       |  1 +
 llvm/lib/Support/FileCollector.cpp            |  6 ++++++
 llvm/lib/Support/FileOutputBuffer.cpp         |  5 ++++-
 llvm/lib/Support/FloatingPointMode.cpp        |  2 ++
 llvm/lib/Support/FoldingSet.cpp               |  6 +++++-
 llvm/lib/Support/FormatVariadic.cpp           |  2 ++
 llvm/lib/Support/FormattedStream.cpp          |  2 ++
 llvm/lib/Support/GlobPattern.cpp              |  6 ++++++
 llvm/lib/Support/GraphWriter.cpp              |  7 +++----
 llvm/lib/Support/InitLLVM.cpp                 |  4 ----
 llvm/lib/Support/JSON.cpp                     |  4 ++++
 llvm/lib/Support/KnownBits.cpp                |  4 ++++
 llvm/lib/Support/LineIterator.cpp             |  2 ++
 llvm/lib/Support/LockFileManager.cpp          |  5 +----
 llvm/lib/Support/MD5.cpp                      |  4 ++++
 llvm/lib/Support/MSP430AttributeParser.cpp    |  1 -
 llvm/lib/Support/ManagedStatic.cpp            |  2 +-
 llvm/lib/Support/MemoryBuffer.cpp             |  4 +++-
 llvm/lib/Support/NativeFormatting.cpp         |  9 ++++++--
 llvm/lib/Support/OptimizedStructLayout.cpp    |  6 ++++++
 llvm/lib/Support/PGOOptions.cpp               |  2 ++
 llvm/lib/Support/Parallel.cpp                 |  4 +++-
 llvm/lib/Support/Path.cpp                     | 15 ++++++++++++-
 llvm/lib/Support/PluginLoader.cpp             |  2 ++
 llvm/lib/Support/Process.cpp                  |  8 +++++--
 llvm/lib/Support/Program.cpp                  |  3 +++
 llvm/lib/Support/RISCVAttributeParser.cpp     |  3 +++
 llvm/lib/Support/RISCVISAUtils.cpp            |  1 +
 llvm/lib/Support/RandomNumberGenerator.cpp    | 12 +++++++----
 llvm/lib/Support/SHA1.cpp                     |  3 +++
 llvm/lib/Support/SHA256.cpp                   |  3 +++
 llvm/lib/Support/ScaledNumber.cpp             |  3 +++
 llvm/lib/Support/ScopedPrinter.cpp            |  4 +++-
 llvm/lib/Support/Signals.cpp                  | 15 ++++++++++---
 llvm/lib/Support/SipHash.cpp                  |  1 +
 llvm/lib/Support/SlowDynamicAPInt.cpp         |  4 ++++
 llvm/lib/Support/SmallPtrSet.cpp              |  1 +
 llvm/lib/Support/SmallVector.cpp              |  2 ++
 llvm/lib/Support/SourceMgr.cpp                |  1 +
 llvm/lib/Support/SpecialCaseList.cpp          |  8 +++++++
 llvm/lib/Support/Statistic.cpp                | 11 ++++++----
 llvm/lib/Support/StringExtras.cpp             |  1 +
 llvm/lib/Support/StringMap.cpp                |  2 ++
 llvm/lib/Support/StringRef.cpp                |  4 ++++
 llvm/lib/Support/StringSaver.cpp              |  3 ++-
 llvm/lib/Support/SuffixTree.cpp               |  6 ++++++
 llvm/lib/Support/SuffixTreeNode.cpp           |  2 +-
 llvm/lib/Support/TarWriter.cpp                |  6 ++++++
 llvm/lib/Support/ThreadPool.cpp               |  7 +++++--
 llvm/lib/Support/Threading.cpp                |  6 +-----
 llvm/lib/Support/TimeProfiler.cpp             | 10 +++++++++
 llvm/lib/Support/Timer.cpp                    | 12 +++++++++--
 llvm/lib/Support/Twine.cpp                    |  2 +-
 llvm/lib/Support/TypeSize.cpp                 |  5 +++--
 llvm/lib/Support/Unicode.cpp                  |  2 ++
 llvm/lib/Support/UnicodeNameToCodepoint.cpp   | 13 ++++++++++++
 .../UnicodeNameToCodepointGenerated.cpp       |  2 +-
 llvm/lib/Support/Unix/Process.inc             |  2 +-
 llvm/lib/Support/Unix/Unix.h                  |  2 +-
 llvm/lib/Support/VirtualFileSystem.cpp        |  8 +++----
 llvm/lib/Support/WithColor.cpp                |  4 ++--
 llvm/lib/Support/YAMLParser.cpp               |  4 ++++
 llvm/lib/Support/YAMLTraits.cpp               |  3 ++-
 llvm/lib/Support/Z3Solver.cpp                 |  9 +++++---
 llvm/lib/Support/circular_raw_ostream.cpp     |  2 ++
 llvm/lib/Support/raw_ostream.cpp              |  8 ++++++-
 llvm/lib/Support/raw_socket_stream.cpp        |  6 ++++--
 llvm/lib/Support/xxhash.cpp                   |  3 ++-
 llvm/tools/llvm-objdump/MachODump.cpp         |  1 +
 llvm/tools/llvm-rc/llvm-rc.cpp                |  1 +
 llvm/tools/llvm-xray/xray-account.cpp         |  1 +
 llvm/tools/llvm-xray/xray-graph-diff.cpp      |  1 +
 llvm/tools/llvm-xray/xray-graph.cpp           |  1 +
 llvm/unittests/TargetParser/Host.cpp          |  1 +
 llvm/utils/FileCheck/FileCheck.cpp            |  1 +
 .../mlir/Analysis/Presburger/Fraction.h       |  1 +
 216 files changed, 798 insertions(+), 176 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/SPIRV.cpp b/clang/lib/Driver/ToolChains/SPIRV.cpp
index ce900600cbee5..2010d1b4f2835 100644
--- a/clang/lib/Driver/ToolChains/SPIRV.cpp
+++ b/clang/lib/Driver/ToolChains/SPIRV.cpp
@@ -12,6 +12,7 @@
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/InputInfo.h"
 #include "clang/Driver/Options.h"
+#include "llvm/Support/FileSystem.h"
 
 using namespace clang::driver;
 using namespace clang::driver::toolchains;
diff --git a/llvm/include/llvm/ADT/APFixedPoint.h b/llvm/include/llvm/ADT/APFixedPoint.h
index 0c014e76aa712..6c004936ce086 100644
--- a/llvm/include/llvm/ADT/APFixedPoint.h
+++ b/llvm/include/llvm/ADT/APFixedPoint.h
@@ -16,16 +16,22 @@
 #ifndef LLVM_ADT_APFIXEDPOINT_H
 #define LLVM_ADT_APFIXEDPOINT_H
 
+#include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
-#include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <assert.h>
+#include <stdint.h>
+#include <string>
 
 namespace llvm {
 
 class APFloat;
 struct fltSemantics;
+template <typename T> class SmallVectorImpl;
 
 /// The fixed point semantics work similarly to fltSemantics. The width
 /// specifies the whole bit width of the underlying scaled integer (with padding
diff --git a/llvm/include/llvm/ADT/APFloat.h b/llvm/include/llvm/ADT/APFloat.h
index 7039e961bff82..48e560c7d9a31 100644
--- a/llvm/include/llvm/ADT/APFloat.h
+++ b/llvm/include/llvm/ADT/APFloat.h
@@ -18,9 +18,22 @@
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/FloatingPointMode.h"
+#include "llvm/ADT/Hashing.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/float128.h"
+#include <assert.h>
+#include <limits.h>
 #include <memory>
+#include <new>
+#include <stdint.h>
+#include <type_traits>
+#include <utility>
+
+namespace llvm {
+class FoldingSetNodeID;
+} // namespace llvm
 
 #define APFLOAT_DISPATCH_ON_SEMANTICS(METHOD_CALL)                             \
   do {                                                                         \
@@ -38,8 +51,6 @@ class APSInt;
 class StringRef;
 class APFloat;
 class raw_ostream;
-
-template <typename T> class Expected;
 template <typename T> class SmallVectorImpl;
 
 /// Enum that represents what fraction of the LSB truncated bits of an fp number
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 108df7e0eaeaa..5a8f822722865 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -15,6 +15,7 @@
 #ifndef LLVM_ADT_APINT_H
 #define LLVM_ADT_APINT_H
 
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/float128.h"
@@ -22,6 +23,7 @@
 #include <climits>
 #include <cstring>
 #include <optional>
+#include <stdint.h>
 #include <utility>
 
 namespace llvm {
diff --git a/llvm/include/llvm/ADT/APSInt.h b/llvm/include/llvm/ADT/APSInt.h
index 90b988875a24d..e90f580d3cd23 100644
--- a/llvm/include/llvm/ADT/APSInt.h
+++ b/llvm/include/llvm/ADT/APSInt.h
@@ -16,8 +16,17 @@
 #define LLVM_ADT_APSINT_H
 
 #include "llvm/ADT/APInt.h"
+#include "llvm/ADT/StringRef.h"
+#include <assert.h>
+#include <optional>
+#include <stdint.h>
+#include <utility>
 
 namespace llvm {
+class FoldingSetNodeID;
+class raw_ostream;
+template <typename T, typename Enable> struct DenseMapInfo;
+template <typename T> class SmallVectorImpl;
 
 /// An arbitrary precision integer that knows its signedness.
 class [[nodiscard]] APSInt : public APInt {
diff --git a/llvm/include/llvm/ADT/DynamicAPInt.h b/llvm/include/llvm/ADT/DynamicAPInt.h
index 4444d52527def..d233ff760b2a1 100644
--- a/llvm/include/llvm/ADT/DynamicAPInt.h
+++ b/llvm/include/llvm/ADT/DynamicAPInt.h
@@ -16,12 +16,20 @@
 #ifndef LLVM_ADT_DYNAMICAPINT_H
 #define LLVM_ADT_DYNAMICAPINT_H
 
+#include "llvm/ADT/APInt.h"
+#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SlowDynamicAPInt.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/raw_ostream.h"
+#include <assert.h>
+#include <limits>
+#include <new>
 #include <numeric>
+#include <stdint.h>
 
 namespace llvm {
+class raw_ostream;
+
 /// This class provides support for dynamic arbitrary-precision arithmetic.
 ///
 /// Unlike APInt, this extends the precision as necessary to prevent overflows
diff --git a/llvm/include/llvm/ADT/FloatingPointMode.h b/llvm/include/llvm/ADT/FloatingPointMode.h
index 639d931ef88fe..7bae2dff81b1d 100644
--- a/llvm/include/llvm/ADT/FloatingPointMode.h
+++ b/llvm/include/llvm/ADT/FloatingPointMode.h
@@ -16,8 +16,12 @@
 #define LLVM_ADT_FLOATINGPOINTMODE_H
 
 #include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/raw_ostream.h"
+#include <stdint.h>
+#include <string>
+#include <tuple>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h
index 3c2eaade57e47..7610d06f469d5 100644
--- a/llvm/include/llvm/ADT/FoldingSet.h
+++ b/llvm/include/llvm/ADT/FoldingSet.h
@@ -16,11 +16,13 @@
 #ifndef LLVM_ADT_FOLDINGSET_H
 #define LLVM_ADT_FOLDINGSET_H
 
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/STLForwardCompat.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/xxhash.h"
 #include <cassert>
 #include <cstddef>
diff --git a/llvm/include/llvm/ADT/IntEqClasses.h b/llvm/include/llvm/ADT/IntEqClasses.h
index 9ee8a46be411e..0bc1cceffacc8 100644
--- a/llvm/include/llvm/ADT/IntEqClasses.h
+++ b/llvm/include/llvm/ADT/IntEqClasses.h
@@ -22,6 +22,7 @@
 #define LLVM_ADT_INTEQCLASSES_H
 
 #include "llvm/ADT/SmallVector.h"
+#include <assert.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/ADT/IntervalMap.h b/llvm/include/llvm/ADT/IntervalMap.h
index 99bf308772233..805f3123a777c 100644
--- a/llvm/include/llvm/ADT/IntervalMap.h
+++ b/llvm/include/llvm/ADT/IntervalMap.h
@@ -110,6 +110,7 @@
 #include "llvm/Support/RecyclingAllocator.h"
 #include <algorithm>
 #include <cassert>
+#include <cstddef>
 #include <iterator>
 #include <new>
 #include <utility>
diff --git a/llvm/include/llvm/ADT/SlowDynamicAPInt.h b/llvm/include/llvm/ADT/SlowDynamicAPInt.h
index cda5f39eb98c3..b22e2bb0abea8 100644
--- a/llvm/include/llvm/ADT/SlowDynamicAPInt.h
+++ b/llvm/include/llvm/ADT/SlowDynamicAPInt.h
@@ -19,10 +19,13 @@
 #define LLVM_ADT_SLOWDYNAMICAPINT_H
 
 #include "llvm/ADT/APInt.h"
-#include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/Hashing.h"
+#include "llvm/Support/Compiler.h"
+#include <stdint.h>
 
 namespace llvm {
 class DynamicAPInt;
+class raw_ostream;
 } // namespace llvm
 
 namespace llvm::detail {
diff --git a/llvm/include/llvm/ADT/SmallPtrSet.h b/llvm/include/llvm/ADT/SmallPtrSet.h
index 597cad8444f69..0e5c24ec9076c 100644
--- a/llvm/include/llvm/ADT/SmallPtrSet.h
+++ b/llvm/include/llvm/ADT/SmallPtrSet.h
@@ -16,7 +16,6 @@
 #define LLVM_ADT_SMALLPTRSET_H
 
 #include "llvm/ADT/EpochTracker.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ReverseIteration.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
@@ -29,6 +28,7 @@
 #include <utility>
 
 namespace llvm {
+template <typename T> struct PointerLikeTypeTraits;
 
 /// SmallPtrSetImplBase - This is the common code shared among all the
 /// SmallPtrSet<>'s, which is almost everything.  SmallPtrSet has two modes, one
diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 17444147b102a..a8ac07bd0fce1 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -15,7 +15,6 @@
 #define LLVM_ADT_SMALLVECTOR_H
 
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/type_traits.h"
 #include <algorithm>
 #include <cassert>
 #include <cstddef>
@@ -28,6 +27,7 @@
 #include <limits>
 #include <memory>
 #include <new>
+#include <stdint.h>
 #include <type_traits>
 #include <utility>
 
diff --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h
index 9475b6697031a..58f0653f947ea 100644
--- a/llvm/include/llvm/ADT/Statistic.h
+++ b/llvm/include/llvm/ADT/Statistic.h
@@ -27,9 +27,10 @@
 #define LLVM_ADT_STATISTIC_H
 
 #include "llvm/Config/llvm-config.h"
-#include "llvm/Support/Compiler.h"
 #include <atomic>
 #include <memory>
+#include <stdint.h>
+#include <utility>
 #include <vector>
 
 // Determine whether statistics should be enabled. We must do it here rather
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h
index 20e6ad1f68f99..0fcdae42d4f5f 100644
--- a/llvm/include/llvm/ADT/StringExtras.h
+++ b/llvm/include/llvm/ADT/StringExtras.h
@@ -14,11 +14,16 @@
 #ifndef LLVM_ADT_STRINGEXTRAS_H
 #define LLVM_ADT_STRINGEXTRAS_H
 
+#include "llvm/ADT/APInt.h"
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <cstddef>
 #include <cstdint>
@@ -26,7 +31,10 @@
 #include <cstring>
 #include <iterator>
 #include <string>
+#include <tuple>
+#include <type_traits>
 #include <utility>
+#include <vector>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/ADT/StringMap.h b/llvm/include/llvm/ADT/StringMap.h
index 9b58af7327391..d9811b5a654d3 100644
--- a/llvm/include/llvm/ADT/StringMap.h
+++ b/llvm/include/llvm/ADT/StringMap.h
@@ -15,11 +15,19 @@
 #define LLVM_ADT_STRINGMAP_H
 
 #include "llvm/ADT/StringMapEntry.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/iterator.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/AllocatorBase.h"
 #include "llvm/Support/PointerLikeTypeTraits.h"
+#include <assert.h>
 #include <initializer_list>
 #include <iterator>
+#include <optional>
+#include <stdint.h>
+#include <stdlib.h>
+#include <type_traits>
+#include <utility>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/ADT/StringRef.h b/llvm/include/llvm/ADT/StringRef.h
index 049f22b03e46e..1677ba827df2a 100644
--- a/llvm/include/llvm/ADT/StringRef.h
+++ b/llvm/include/llvm/ADT/StringRef.h
@@ -18,6 +18,7 @@
 #include <cstddef>
 #include <cstring>
 #include <limits>
+#include <stdint.h>
 #include <string>
 #include <string_view>
 #include <type_traits>
diff --git a/llvm/include/llvm/ADT/Twine.h b/llvm/include/llvm/ADT/Twine.h
index 1f1fd1967efbc..bbe911038bb2f 100644
--- a/llvm/include/llvm/ADT/Twine.h
+++ b/llvm/include/llvm/ADT/Twine.h
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ErrorHandling.h"
 #include <cassert>
+#include <cstddef>
 #include <cstdint>
 #include <string>
 #include <string_view>
diff --git a/llvm/include/llvm/Support/ARMAttributeParser.h b/llvm/include/llvm/Support/ARMAttributeParser.h
index d1d953120ae7e..59f479f68ffb3 100644
--- a/llvm/include/llvm/Support/ARMAttributeParser.h
+++ b/llvm/include/llvm/Support/ARMAttributeParser.h
@@ -13,6 +13,7 @@
 #include "ELFAttributeParser.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/ARMWinEH.h b/llvm/include/llvm/Support/ARMWinEH.h
index b6710cca95650..a9888936b521f 100644
--- a/llvm/include/llvm/Support/ARMWinEH.h
+++ b/llvm/include/llvm/Support/ARMWinEH.h
@@ -11,6 +11,10 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Endian.h"
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <utility>
 
 namespace llvm {
 namespace ARM {
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..d7a15db5218e5 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -39,18 +39,22 @@
 #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
-#include "raw_ostream.h"
 #include "llvm/ADT/ArrayRef.h"
-
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/iterator_range.h"
 #include <atomic>
 #include <condition_variable>
 #include <mutex>
+#include <optional>
 #include <random>
+#include <stdint.h>
 #include <vector>
 
 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/Base64.h b/llvm/include/llvm/Support/Base64.h
index 3d96884749b32..fc3d9fcaf32c5 100644
--- a/llvm/include/llvm/Support/Base64.h
+++ b/llvm/include/llvm/Support/Base64.h
@@ -15,10 +15,12 @@
 
 #include "llvm/Support/Error.h"
 #include <cstdint>
+#include <stddef.h>
 #include <string>
 #include <vector>
 
 namespace llvm {
+class StringRef;
 
 template <class InputBytes> std::string encodeBase64(InputBytes const &Bytes) {
   static const char Table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
diff --git a/llvm/include/llvm/Support/BinaryStreamError.h b/llvm/include/llvm/Support/BinaryStreamError.h
index cf6e034ffd2ce..d4bebae72048c 100644
--- a/llvm/include/llvm/Support/BinaryStreamError.h
+++ b/llvm/include/llvm/Support/BinaryStreamError.h
@@ -11,10 +11,12 @@
 
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
-
 #include <string>
+#include <system_error>
 
 namespace llvm {
+class raw_ostream;
+
 enum class stream_error_code {
   unspecified,
   stream_too_short,
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03a..a15e5426b103a 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -11,15 +11,20 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Alignment.h"
 #include "llvm/Support/BinaryStreamArray.h"
+#include "llvm/Support/BinaryStreamError.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
+#include <assert.h>
+#include <stdint.h>
 #include <type_traits>
+#include <utility>
 
 namespace llvm {
+class BinaryStream;
+enum class endianness;
 
 /// Provides read only access to a subclass of `BinaryStream`.  Provides
 /// bounds checking and helpers for writing certain common data types such as
diff --git a/llvm/include/llvm/Support/BinaryStreamRef.h b/llvm/include/llvm/Support/BinaryStreamRef.h
index fdc46f5fd5605..aaa8184ddc0d6 100644
--- a/llvm/include/llvm/Support/BinaryStreamRef.h
+++ b/llvm/include/llvm/Support/BinaryStreamRef.h
@@ -10,14 +10,20 @@
 #define LLVM_SUPPORT_BINARYSTREAMREF_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/BitmaskEnum.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/BinaryStream.h"
 #include "llvm/Support/BinaryStreamError.h"
 #include "llvm/Support/Error.h"
+#include <algorithm>
+#include <assert.h>
 #include <cstdint>
 #include <memory>
 #include <optional>
+#include <utility>
 
 namespace llvm {
+enum class endianness;
 
 /// Common stuff for mutable and immutable StreamRefs.
 template <class RefType, class StreamType> class BinaryStreamRefBase {
diff --git a/llvm/include/llvm/Support/BinaryStreamWriter.h b/llvm/include/llvm/Support/BinaryStreamWriter.h
index bc1d7949841d6..2bd6d30f09d47 100644
--- a/llvm/include/llvm/Support/BinaryStreamWriter.h
+++ b/llvm/include/llvm/Support/BinaryStreamWriter.h
@@ -21,6 +21,8 @@
 #include <utility>
 
 namespace llvm {
+class WritableBinaryStream;
+enum class endianness;
 
 /// Provides write only access to a subclass of `WritableBinaryStream`.
 /// Provides bounds checking and helpers for writing certain common data types
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d41..894837790d5be 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,11 +13,11 @@
 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
 #include <numeric>
+#include <stdint.h>
 
 namespace llvm {
 
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/CSKYAttributeParser.h b/llvm/include/llvm/Support/CSKYAttributeParser.h
index e926ebe5e306e..e1023c37ae9e6 100644
--- a/llvm/include/llvm/Support/CSKYAttributeParser.h
+++ b/llvm/include/llvm/Support/CSKYAttributeParser.h
@@ -9,10 +9,15 @@
 #ifndef LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
 #define LLVM_SUPPORT_CSKYATTRIBUTEPARSER_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CSKYAttributes.h"
 #include "llvm/Support/ELFAttributeParser.h"
+#include "llvm/Support/Error.h"
+#include <stdint.h>
 
 namespace llvm {
+class ScopedPrinter;
+
 class CSKYAttributeParser : public ELFAttributeParser {
   struct DisplayHandler {
     CSKYAttrs::AttrType attribute;
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f..fc12fdecd4678 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,14 +14,17 @@
 #ifndef LLVM_SUPPORT_CACHEPRUNING_H
 #define LLVM_SUPPORT_CACHEPRUNING_H
 
-#include "llvm/Support/MemoryBuffer.h"
 #include <chrono>
+#include <memory>
 #include <optional>
+#include <stdint.h>
+#include <vector>
 
 namespace llvm {
 
 template <typename T> class Expected;
 class StringRef;
+class MemoryBuffer;
 
 /// Policy for the pruneCache() function. A default constructed
 /// CachePruningPolicy provides a reasonable default policy.
diff --git a/llvm/include/llvm/Support/Caching.h b/llvm/include/llvm/Support/Caching.h
index 4fa57cc92e51f..7876c3ef47226 100644
--- a/llvm/include/llvm/Support/Caching.h
+++ b/llvm/include/llvm/Support/Caching.h
@@ -15,7 +15,15 @@
 #ifndef LLVM_SUPPORT_CACHING_H
 #define LLVM_SUPPORT_CACHING_H
 
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/raw_ostream.h"
+#include <functional>
+#include <memory>
+#include <stddef.h>
+#include <string>
+#include <utility>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a..31fb04f406243 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -9,17 +9,20 @@
 #ifndef LLVM_SUPPORT_CHRONO_H
 #define LLVM_SUPPORT_CHRONO_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormatProviders.h"
-
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/FormatVariadicDetails.h"
+#include "llvm/Support/raw_ostream.h"
+#include <assert.h>
 #include <chrono>
 #include <ctime>
 #include <ratio>
+#include <stdint.h>
+#include <tuple>
+#include <type_traits>
+#include <utility>
 
 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/CodeGenCoverage.h b/llvm/include/llvm/Support/CodeGenCoverage.h
index 2acdd6a36a514..df81824325ef6 100644
--- a/llvm/include/llvm/Support/CodeGenCoverage.h
+++ b/llvm/include/llvm/Support/CodeGenCoverage.h
@@ -12,6 +12,9 @@
 #define LLVM_SUPPORT_CODEGENCOVERAGE_H
 
 #include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
+#include <stdint.h>
 
 namespace llvm {
 class MemoryBuffer;
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb20..ad96cb11b9bc9 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -20,22 +20,24 @@
 #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"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/Allocator.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <climits>
 #include <cstddef>
 #include <functional>
 #include <initializer_list>
+#include <stdint.h>
 #include <string>
+#include <tuple>
 #include <type_traits>
 #include <vector>
 
@@ -45,8 +47,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..218ce6e460f93 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -13,11 +13,12 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#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/DJB.h b/llvm/include/llvm/Support/DJB.h
index 8a04a324a5dc6..dd97816be977c 100644
--- a/llvm/include/llvm/Support/DJB.h
+++ b/llvm/include/llvm/Support/DJB.h
@@ -14,6 +14,7 @@
 #define LLVM_SUPPORT_DJB_H
 
 #include "llvm/ADT/StringRef.h"
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd..8e2aa21909c73 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -9,9 +9,13 @@
 #ifndef LLVM_SUPPORT_DATAEXTRACTOR_H
 #define LLVM_SUPPORT_DATAEXTRACTOR_H
 
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
+#include <stddef.h>
+#include <stdint.h>
+#include <utility>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99..9e45be181f881 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -42,16 +42,21 @@
 #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/Compiler.h"
 #include "llvm/Support/Debug.h"
+#include <assert.h>
+#include <stdint.h>
 #include <string>
+#include <utility>
 
 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..b8f09d4a67985 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -11,15 +11,17 @@
 
 #include "ELFAttributes.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataExtractor.h"
 #include "llvm/Support/Error.h"
-
 #include <optional>
+#include <stdint.h>
 #include <unordered_map>
 
 namespace llvm {
-class StringRef;
 class ScopedPrinter;
+enum class endianness;
+template <typename T> class SmallVectorImpl;
 
 class ELFAttributeParser {
   StringRef vendor;
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7..e0b90a3175bce 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -14,6 +14,7 @@
 #define LLVM_SUPPORT_ERROR_H
 
 #include "llvm-c/Error.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
@@ -24,8 +25,8 @@
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <cstdint>
 #include <cstdlib>
+#include <errno.h>
 #include <functional>
 #include <memory>
 #include <new>
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a..1a4f4fc95f46f 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -12,10 +12,9 @@
 #ifndef LLVM_EXPONENTIALBACKOFF_H
 #define LLVM_EXPONENTIALBACKOFF_H
 
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Error.h"
 #include <chrono>
 #include <random>
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/FileCollector.h b/llvm/include/llvm/Support/FileCollector.h
index 232dc8658aa38..8e5bf106e04a9 100644
--- a/llvm/include/llvm/Support/FileCollector.h
+++ b/llvm/include/llvm/Support/FileCollector.h
@@ -9,15 +9,23 @@
 #ifndef LLVM_SUPPORT_FILECOLLECTOR_H
 #define LLVM_SUPPORT_FILECOLLECTOR_H
 
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include <memory>
 #include <mutex>
 #include <string>
+#include <system_error>
+#include <utility>
 
 namespace llvm {
 class FileCollectorFileSystem;
 class Twine;
+template <typename T> class SmallVectorImpl;
 
 class FileCollectorBase {
 public:
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115db..07f03115e8daa 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,8 +14,11 @@
 #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
+#include <memory>
+#include <stddef.h>
+#include <stdint.h>
+#include <string>
 
 namespace llvm {
 /// FileOutputBuffer - This interface provides simple way to create an in-memory
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d63170..04b761aac1844 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -14,11 +14,13 @@
 #ifndef LLVM_SUPPORT_FILEUTILITIES_H
 #define LLVM_SUPPORT_FILEUTILITIES_H
 
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
-
-#include <system_error>
+#include <optional>
+#include <string>
 
 namespace llvm {
 
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/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h
index a221fcadbd3c7..60d4221540dd6 100644
--- a/llvm/include/llvm/Support/FormatVariadicDetails.h
+++ b/llvm/include/llvm/Support/FormatVariadicDetails.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_FORMATVARIADICDETAILS_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include <type_traits>
diff --git a/llvm/include/llvm/Support/FormattedStream.h b/llvm/include/llvm/Support/FormattedStream.h
index 850a18dbb9412..d98ad4b744f98 100644
--- a/llvm/include/llvm/Support/FormattedStream.h
+++ b/llvm/include/llvm/Support/FormattedStream.h
@@ -16,6 +16,9 @@
 
 #include "llvm/ADT/SmallString.h"
 #include "llvm/Support/raw_ostream.h"
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
 #include <utility>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/GlobPattern.h b/llvm/include/llvm/Support/GlobPattern.h
index 1a722e65bed80..be430ff123613 100644
--- a/llvm/include/llvm/Support/GlobPattern.h
+++ b/llvm/include/llvm/Support/GlobPattern.h
@@ -18,6 +18,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Error.h"
 #include <optional>
+#include <stddef.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/GraphWriter.h b/llvm/include/llvm/Support/GraphWriter.h
index 359b608626dff..0bb2e8633d904 100644
--- a/llvm/include/llvm/Support/GraphWriter.h
+++ b/llvm/include/llvm/Support/GraphWriter.h
@@ -30,6 +30,7 @@
 #include "llvm/Support/raw_ostream.h"
 #include <iterator>
 #include <string>
+#include <system_error>
 #include <type_traits>
 #include <vector>
 
diff --git a/llvm/include/llvm/Support/HexagonAttributeParser.h b/llvm/include/llvm/Support/HexagonAttributeParser.h
index 1116dd42b1ad0..ecfc93b82739c 100644
--- a/llvm/include/llvm/Support/HexagonAttributeParser.h
+++ b/llvm/include/llvm/Support/HexagonAttributeParser.h
@@ -9,10 +9,15 @@
 #ifndef LLVM_SUPPORT_HEXAGONATTRIBUTEPARSER_H
 #define LLVM_SUPPORT_HEXAGONATTRIBUTEPARSER_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ELFAttributeParser.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/HexagonAttributes.h"
+#include <stdint.h>
 
 namespace llvm {
+class ScopedPrinter;
+
 class HexagonAttributeParser : public ELFAttributeParser {
   struct DisplayHandler {
     HexagonAttrs::AttrType Attribute;
diff --git a/llvm/include/llvm/Support/InstructionCost.h b/llvm/include/llvm/Support/InstructionCost.h
index ada0b8962881d..ee027c5f0ba88 100644
--- a/llvm/include/llvm/Support/InstructionCost.h
+++ b/llvm/include/llvm/Support/InstructionCost.h
@@ -21,6 +21,7 @@
 #include "llvm/Support/MathExtras.h"
 #include <limits>
 #include <optional>
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h
index 14a5c7142ed8c..65b3fc3e7ba8b 100644
--- a/llvm/include/llvm/Support/JSON.h
+++ b/llvm/include/llvm/Support/JSON.h
@@ -50,15 +50,34 @@
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
+#include <assert.h>
 #include <cmath>
+#include <cstddef>
+#include <initializer_list>
+#include <limits>
 #include <map>
+#include <memory>
+#include <new>
+#include <optional>
+#include <stdint.h>
+#include <string>
+#include <system_error>
+#include <type_traits>
+#include <utility>
+#include <vector>
 
 namespace llvm {
 namespace json {
+class Array;
+class Object;
+class ObjectKey;
+class Value;
 
 // === String encodings ===
 //
@@ -91,6 +110,7 @@ std::string fixUTF8(llvm::StringRef S);
 class Array;
 class ObjectKey;
 class Value;
+
 template <typename T> Value toJSON(const std::optional<T> &Opt);
 
 /// An Object is a JSON object, which maps strings to heterogenous JSON values.
@@ -110,6 +130,7 @@ class Object {
   // KV is a trivial key-value struct for list-initialization.
   // (using std::pair forces extra copies).
   struct KV;
+
   explicit Object(std::initializer_list<KV> Properties);
 
   iterator begin() { return M.begin(); }
diff --git a/llvm/include/llvm/Support/KnownBits.h b/llvm/include/llvm/Support/KnownBits.h
index 7ed3d525bd8fb..489c802601867 100644
--- a/llvm/include/llvm/Support/KnownBits.h
+++ b/llvm/include/llvm/Support/KnownBits.h
@@ -15,9 +15,12 @@
 #define LLVM_SUPPORT_KNOWNBITS_H
 
 #include "llvm/ADT/APInt.h"
+#include <assert.h>
 #include <optional>
+#include <utility>
 
 namespace llvm {
+class raw_ostream;
 
 // Struct for tracking the known zeros and ones of a value.
 struct KnownBits {
diff --git a/llvm/include/llvm/Support/LEB128.h b/llvm/include/llvm/Support/LEB128.h
index a15b73bc14dcd..63533164f13ba 100644
--- a/llvm/include/llvm/Support/LEB128.h
+++ b/llvm/include/llvm/Support/LEB128.h
@@ -14,7 +14,9 @@
 #ifndef LLVM_SUPPORT_LEB128_H
 #define LLVM_SUPPORT_LEB128_H
 
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a6..0f910c69cfab6 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,10 +10,11 @@
 #define LLVM_SUPPORT_LINEITERATOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MemoryBufferRef.h"
+#include <cstddef>
 #include <iterator>
 #include <optional>
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929..50d38f8ed3e35 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -9,12 +9,13 @@
 #define LLVM_SUPPORT_LOCKFILEMANAGER_H
 
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
 #include <optional>
+#include <string>
 #include <system_error>
 #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/MD5.h b/llvm/include/llvm/Support/MD5.h
index 0e9f22d3bfdb4..d1327c93ee803 100644
--- a/llvm/include/llvm/Support/MD5.h
+++ b/llvm/include/llvm/Support/MD5.h
@@ -29,14 +29,17 @@
 #define LLVM_SUPPORT_MD5_H
 
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Endian.h"
 #include <array>
 #include <cstdint>
+#include <utility>
 
 namespace llvm {
 
 template <unsigned N> class SmallString;
 template <typename T> class ArrayRef;
+template <typename T> class SmallVectorImpl;
 
 class MD5 {
 public:
diff --git a/llvm/include/llvm/Support/MSP430AttributeParser.h b/llvm/include/llvm/Support/MSP430AttributeParser.h
index bc9b214944708..57186a6286d79 100644
--- a/llvm/include/llvm/Support/MSP430AttributeParser.h
+++ b/llvm/include/llvm/Support/MSP430AttributeParser.h
@@ -15,9 +15,14 @@
 #define LLVM_SUPPORT_MSP430ATTRIBUTEPARSER_H
 
 #include "llvm/Support/ELFAttributeParser.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/MSP430Attributes.h"
+#include <array>
+#include <stdint.h>
 
 namespace llvm {
+class ScopedPrinter;
+
 class MSP430AttributeParser : public ELFAttributeParser {
   struct DisplayHandler {
     MSP430Attrs::AttrType Attribute;
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index e568e42afcf4d..9d67d356e0718 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..33cd02d7fdeae 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_SUPPORT_MEMORY_H
 #define LLVM_SUPPORT_MEMORY_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stddef.h>
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/MemoryBuffer.h b/llvm/include/llvm/Support/MemoryBuffer.h
index b3477f1db0e9a..ebd076f2e8a8f 100644
--- a/llvm/include/llvm/Support/MemoryBuffer.h
+++ b/llvm/include/llvm/Support/MemoryBuffer.h
@@ -24,6 +24,7 @@
 #include <cstddef>
 #include <cstdint>
 #include <memory>
+#include <optional>
 
 namespace llvm {
 namespace sys {
diff --git a/llvm/include/llvm/Support/MemoryBufferRef.h b/llvm/include/llvm/Support/MemoryBufferRef.h
index b38a1f3b65651..72c1571544205 100644
--- a/llvm/include/llvm/Support/MemoryBufferRef.h
+++ b/llvm/include/llvm/Support/MemoryBufferRef.h
@@ -14,6 +14,7 @@
 #define LLVM_SUPPORT_MEMORYBUFFERREF_H
 
 #include "llvm/ADT/StringRef.h"
+#include <stddef.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/NativeFormatting.h b/llvm/include/llvm/Support/NativeFormatting.h
index ab85ae20161c2..2b369aec8c719 100644
--- a/llvm/include/llvm/Support/NativeFormatting.h
+++ b/llvm/include/llvm/Support/NativeFormatting.h
@@ -11,6 +11,7 @@
 
 #include <cstdint>
 #include <optional>
+#include <stddef.h>
 
 namespace llvm {
 class raw_ostream;
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beb..11eaad346f6b3 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -35,8 +35,10 @@
 #ifndef LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 #define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 
-#include "llvm/Support/Alignment.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Support/Alignment.h"
+#include <assert.h>
+#include <stdint.h>
 #include <utility>
 
 namespace llvm {
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/Parallel.h b/llvm/include/llvm/Support/Parallel.h
index 8170da98f15a8..7e3ac48ab6fa0 100644
--- a/llvm/include/llvm/Support/Parallel.h
+++ b/llvm/include/llvm/Support/Parallel.h
@@ -9,18 +9,26 @@
 #ifndef LLVM_SUPPORT_PARALLEL_H
 #define LLVM_SUPPORT_PARALLEL_H
 
+#include "llvm-c/Error.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Threading.h"
-
 #include <algorithm>
+#include <assert.h>
 #include <condition_variable>
 #include <functional>
+#include <iterator>
+#include <limits.h>
 #include <mutex>
+#include <stddef.h>
+#include <stdint.h>
+#include <vector>
 
 namespace llvm {
+template <typename Fn> class function_ref;
 
 namespace parallel {
 
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81..f77271256deb6 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -15,12 +15,16 @@
 #ifndef LLVM_SUPPORT_PATH_H
 #define LLVM_SUPPORT_PATH_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/DataTypes.h"
 #include <iterator>
+#include <stddef.h>
+#include <string>
 
 namespace llvm {
+template <typename T> class SmallVectorImpl;
+
 namespace sys {
 namespace path {
 
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..d05a10844af6e 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,10 +25,13 @@
 #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 <chrono>
 #include <optional>
+#include <stddef.h>
+#include <stdint.h>
+#include <string>
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/Program.h b/llvm/include/llvm/Support/Program.h
index 9df94eb604c7d..171e18fd5a268 100644
--- a/llvm/include/llvm/Support/Program.h
+++ b/llvm/include/llvm/Support/Program.h
@@ -17,14 +17,21 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/FileSystem.h"
 #include <chrono>
 #include <optional>
+#include <stdint.h>
+#include <string>
+#include <sys/types.h>
 #include <system_error>
 
 namespace llvm {
 class BitVector;
+class raw_ostream;
+
 namespace sys {
+namespace fs {
+enum OpenFlags : unsigned int;
+} // namespace fs
 
   /// This is the OS-specific separator for PATH like environment variables:
   // a colon on Unix or a semicolon on Windows.
diff --git a/llvm/include/llvm/Support/RISCVAttributeParser.h b/llvm/include/llvm/Support/RISCVAttributeParser.h
index 9f295504de959..bce236b8c8d16 100644
--- a/llvm/include/llvm/Support/RISCVAttributeParser.h
+++ b/llvm/include/llvm/Support/RISCVAttributeParser.h
@@ -9,10 +9,15 @@
 #ifndef LLVM_SUPPORT_RISCVATTRIBUTEPARSER_H
 #define LLVM_SUPPORT_RISCVATTRIBUTEPARSER_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ELFAttributeParser.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/RISCVAttributes.h"
+#include <stdint.h>
 
 namespace llvm {
+class ScopedPrinter;
+
 class RISCVAttributeParser : public ELFAttributeParser {
   struct DisplayHandler {
     RISCVAttrs::AttrType attribute;
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41..d510cd8a0d6e8 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -15,9 +15,8 @@
 #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 <stddef.h>
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/ScaledNumber.h b/llvm/include/llvm/Support/ScaledNumber.h
index faf3ce351c3e5..f19863eaf2f30 100644
--- a/llvm/include/llvm/Support/ScaledNumber.h
+++ b/llvm/include/llvm/Support/ScaledNumber.h
@@ -21,8 +21,10 @@
 #ifndef LLVM_SUPPORT_SCALEDNUMBER_H
 #define LLVM_SUPPORT_SCALEDNUMBER_H
 
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/MathExtras.h"
 #include <algorithm>
+#include <assert.h>
 #include <cstdint>
 #include <limits>
 #include <string>
@@ -417,6 +419,7 @@ inline std::pair<uint64_t, int16_t> getDifference64(uint64_t LDigits,
 namespace llvm {
 
 class raw_ostream;
+
 class ScaledNumberBase {
 public:
   static constexpr int DefaultPrecision = 10;
diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index 419ab97366796..2c481345bb6aa 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -11,13 +11,17 @@
 
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Endian.h"
+#include "llvm/Support/Format.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/raw_ostream.h"
+#include <memory>
+#include <stdint.h>
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/SourceMgr.h b/llvm/include/llvm/Support/SourceMgr.h
index 7a4b6de1162da..fc6cb212919c8 100644
--- a/llvm/include/llvm/Support/SourceMgr.h
+++ b/llvm/include/llvm/Support/SourceMgr.h
@@ -15,9 +15,20 @@
 #ifndef LLVM_SUPPORT_SOURCEMGR_H
 #define LLVM_SUPPORT_SOURCEMGR_H
 
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/SMLoc.h"
+#include <algorithm>
+#include <assert.h>
+#include <iterator>
+#include <memory>
+#include <stddef.h>
+#include <string>
+#include <utility>
 #include <vector>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index 6dc1a29c5a281..d2b9aa0954d37 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -13,15 +13,17 @@
 #define LLVM_SUPPORT_SPECIALCASELIST_H
 
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/GlobPattern.h"
 #include "llvm/Support/Regex.h"
 #include <memory>
 #include <string>
+#include <utility>
 #include <vector>
 
 namespace llvm {
 class MemoryBuffer;
-class StringRef;
 
 namespace vfs {
 class FileSystem;
diff --git a/llvm/include/llvm/Support/StringSaver.h b/llvm/include/llvm/Support/StringSaver.h
index 95ace0e0e29a0..28dfcc2bda217 100644
--- a/llvm/include/llvm/Support/StringSaver.h
+++ b/llvm/include/llvm/Support/StringSaver.h
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Allocator.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/SuffixTree.h b/llvm/include/llvm/Support/SuffixTree.h
index 37b7366640430..589b978f639a4 100644
--- a/llvm/include/llvm/Support/SuffixTree.h
+++ b/llvm/include/llvm/Support/SuffixTree.h
@@ -33,8 +33,10 @@
 #define LLVM_SUPPORT_SUFFIXTREE_H
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/SuffixTreeNode.h"
+#include <vector>
 
 namespace llvm {
 class SuffixTree {
diff --git a/llvm/include/llvm/Support/TarWriter.h b/llvm/include/llvm/Support/TarWriter.h
index 48d810ac65e35..7313dff029310 100644
--- a/llvm/include/llvm/Support/TarWriter.h
+++ b/llvm/include/llvm/Support/TarWriter.h
@@ -13,6 +13,8 @@
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/raw_ostream.h"
+#include <memory>
+#include <string>
 
 namespace llvm {
 class TarWriter {
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 014b7a09d7c8b..680676abee7ef 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -15,22 +15,22 @@
 
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/RWMutex.h"
 #include "llvm/Support/Threading.h"
-#include "llvm/Support/thread.h"
-
-#include <future>
-
+#include <assert.h>
 #include <condition_variable>
 #include <deque>
 #include <functional>
-#include <memory>
+#include <future>
 #include <mutex>
 #include <utility>
+#include <vector>
 
 namespace llvm {
 
 class ThreadPoolTaskGroup;
+class thread;
 
 /// This defines the abstract base interface for a ThreadPool allowing
 /// asynchronous parallel execution on a defined number of threads.
diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h
index ba6c531ab4db2..56f32d7efe565 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -17,9 +17,9 @@
 #include "llvm/ADT/BitVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX
-#include "llvm/Support/Compiler.h"
-#include <ciso646> // So we can check the C++ standard lib macros.
 #include <optional>
+#include <stdint.h>
+#include <utility>
 
 #if defined(_MSC_VER)
 // MSVC's call_once implementation worked since VS 2015, which is the minimum
@@ -47,6 +47,7 @@
 
 namespace llvm {
 class Twine;
+template <typename T> class SmallVectorImpl;
 
 /// Returns true if LLVM is compiled with support for multi-threading, and
 /// false otherwise.
diff --git a/llvm/include/llvm/Support/TimeProfiler.h b/llvm/include/llvm/Support/TimeProfiler.h
index 9e2ba31991f54..c5f6fed6cc801 100644
--- a/llvm/include/llvm/Support/TimeProfiler.h
+++ b/llvm/include/llvm/Support/TimeProfiler.h
@@ -78,10 +78,12 @@
 
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Support/Error.h"
+#include <string>
 
 namespace llvm {
 
 class raw_pwrite_stream;
+class StringRef;
 
 struct TimeTraceMetadata {
   std::string Detail;
diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h
index 1a32832b6c653..8facc422d5699 100644
--- a/llvm/include/llvm/Support/Timer.h
+++ b/llvm/include/llvm/Support/Timer.h
@@ -11,10 +11,11 @@
 
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include <cassert>
 #include <memory>
+#include <stdint.h>
 #include <string>
+#include <sys/types.h>
 #include <vector>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/ToolOutputFile.h b/llvm/include/llvm/Support/ToolOutputFile.h
index c16fb03d9b22b..d7a2903a36e8e 100644
--- a/llvm/include/llvm/Support/ToolOutputFile.h
+++ b/llvm/include/llvm/Support/ToolOutputFile.h
@@ -13,10 +13,18 @@
 #ifndef LLVM_SUPPORT_TOOLOUTPUTFILE_H
 #define LLVM_SUPPORT_TOOLOUTPUTFILE_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/raw_ostream.h"
 #include <optional>
+#include <string>
+#include <system_error>
 
 namespace llvm {
+namespace sys {
+namespace fs {
+enum OpenFlags : unsigned int;
+} // namespace fs
+} // namespace sys
 
 class CleanupInstaller {
 public:
diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index bae833ecca7d4..c41173119ad95 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -15,10 +15,9 @@
 #ifndef LLVM_SUPPORT_TYPESIZE_H
 #define LLVM_SUPPORT_TYPESIZE_H
 
+#include "llvm/ADT/DenseMapInfo.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
-
-#include <algorithm>
 #include <cassert>
 #include <cstdint>
 #include <type_traits>
diff --git a/llvm/include/llvm/Support/Unicode.h b/llvm/include/llvm/Support/Unicode.h
index 861548728d4f8..01610e67eb8b3 100644
--- a/llvm/include/llvm/Support/Unicode.h
+++ b/llvm/include/llvm/Support/Unicode.h
@@ -15,7 +15,10 @@
 #define LLVM_SUPPORT_UNICODE_H
 
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
+#include <cstddef>
 #include <optional>
+#include <stdint.h>
 #include <string>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/VersionTuple.h b/llvm/include/llvm/Support/VersionTuple.h
index 0a4623f049d28..e8448e512c77d 100644
--- a/llvm/include/llvm/Support/VersionTuple.h
+++ b/llvm/include/llvm/Support/VersionTuple.h
@@ -24,6 +24,7 @@ namespace llvm {
 template <typename HasherT, llvm::endianness Endianness> class HashBuilder;
 class raw_ostream;
 class StringRef;
+enum class endianness;
 
 /// Represents a version number in the form major[.minor[.subminor[.build]]].
 class VersionTuple {
diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index f7cfcd4058e72..e704fef2809f0 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -15,17 +15,24 @@
 #define LLVM_SUPPORT_VIRTUALFILESYSTEM_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/Errc.h"
-#include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/ExtensibleRTTI.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FileSystem/UniqueID.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SourceMgr.h"
+#include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <cstdint>
 #include <ctime>
@@ -38,9 +45,9 @@
 
 namespace llvm {
 
-class MemoryBuffer;
 class MemoryBufferRef;
 class Twine;
+template <typename T> class ArrayRef;
 
 namespace vfs {
 
@@ -658,9 +665,6 @@ struct YAMLVFSEntry {
   bool IsDirectory = false;
 };
 
-class RedirectingFSDirIterImpl;
-class RedirectingFileSystemParser;
-
 /// A virtual file system parsed from a YAML file.
 ///
 /// Currently, this class allows creating virtual files and directories. Virtual
diff --git a/llvm/include/llvm/Support/Watchdog.h b/llvm/include/llvm/Support/Watchdog.h
index 281595e8f2722..b27cda39d09e7 100644
--- a/llvm/include/llvm/Support/Watchdog.h
+++ b/llvm/include/llvm/Support/Watchdog.h
@@ -13,8 +13,6 @@
 #ifndef LLVM_SUPPORT_WATCHDOG_H
 #define LLVM_SUPPORT_WATCHDOG_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
   namespace sys {
 
diff --git a/llvm/include/llvm/Support/WithColor.h b/llvm/include/llvm/Support/WithColor.h
index e80e5d469363d..64f4deedc75f1 100644
--- a/llvm/include/llvm/Support/WithColor.h
+++ b/llvm/include/llvm/Support/WithColor.h
@@ -9,13 +9,13 @@
 #ifndef LLVM_SUPPORT_WITHCOLOR_H
 #define LLVM_SUPPORT_WITHCOLOR_H
 
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/raw_ostream.h"
 
 namespace llvm {
 
 class Error;
-class StringRef;
 
 namespace cl {
 class OptionCategory;
diff --git a/llvm/include/llvm/Support/YAMLParser.h b/llvm/include/llvm/Support/YAMLParser.h
index 9d95a1e13a0df..3c58cded8bea5 100644
--- a/llvm/include/llvm/Support/YAMLParser.h
+++ b/llvm/include/llvm/Support/YAMLParser.h
@@ -54,6 +54,7 @@ namespace llvm {
 class MemoryBufferRef;
 class raw_ostream;
 class Twine;
+template <typename T> class SmallVectorImpl;
 
 namespace yaml {
 
diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h
index 1d04783753d5c..873f3a34b91bc 100644
--- a/llvm/include/llvm/Support/YAMLTraits.h
+++ b/llvm/include/llvm/Support/YAMLTraits.h
@@ -11,6 +11,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitVector.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
@@ -18,26 +19,37 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Allocator.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Endian.h"
+#include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/YAMLParser.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
+#include <cstring>
 #include <map>
 #include <memory>
 #include <new>
 #include <optional>
+#include <stdint.h>
 #include <string>
 #include <system_error>
 #include <type_traits>
+#include <utility>
 #include <vector>
 
 namespace llvm {
 
 class VersionTuple;
+enum class endianness;
+template <typename T, T> struct SameType;
 
 namespace yaml {
+struct Hex16;
+struct Hex32;
+struct Hex64;
+struct Hex8;
 
 enum class NodeKind : uint8_t {
   Scalar,
diff --git a/llvm/include/llvm/Support/circular_raw_ostream.h b/llvm/include/llvm/Support/circular_raw_ostream.h
index 17fb8fa0e476f..0d14dbcee98d5 100644
--- a/llvm/include/llvm/Support/circular_raw_ostream.h
+++ b/llvm/include/llvm/Support/circular_raw_ostream.h
@@ -15,6 +15,8 @@
 #define LLVM_SUPPORT_CIRCULAR_RAW_OSTREAM_H
 
 #include "llvm/Support/raw_ostream.h"
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
   /// circular_raw_ostream - A raw_ostream which *can* save its data
diff --git a/llvm/include/llvm/Support/raw_os_ostream.h b/llvm/include/llvm/Support/raw_os_ostream.h
index c51a94da3a28d..e3db48cb7c778 100644
--- a/llvm/include/llvm/Support/raw_os_ostream.h
+++ b/llvm/include/llvm/Support/raw_os_ostream.h
@@ -15,6 +15,8 @@
 
 #include "llvm/Support/raw_ostream.h"
 #include <iosfwd>
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index df9ee2e5a7858..895eac0d6d2a2 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -16,18 +16,22 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DataTypes.h"
-#include <cassert>
 #include <cstddef>
 #include <cstdint>
 #include <cstring>
+#include <functional>
+#include <memory>
 #include <optional>
 #include <string>
 #include <string_view>
+#include <sys/types.h>
 #include <system_error>
 #include <type_traits>
+#include <utility>
 
 namespace llvm {
 
+class APInt;
 class Duration;
 class formatv_object_base;
 class format_object_base;
@@ -35,6 +39,8 @@ class FormattedString;
 class FormattedNumber;
 class FormattedBytes;
 template <class T> class [[nodiscard]] Expected;
+class raw_string_ostream;
+class raw_svector_ostream;
 
 namespace sys {
 namespace fs {
diff --git a/llvm/include/llvm/Support/raw_socket_stream.h b/llvm/include/llvm/Support/raw_socket_stream.h
index 6c65a66dec9a4..e05857a4ce6f1 100644
--- a/llvm/include/llvm/Support/raw_socket_stream.h
+++ b/llvm/include/llvm/Support/raw_socket_stream.h
@@ -14,11 +14,15 @@
 #ifndef LLVM_SUPPORT_RAW_SOCKET_STREAM_H
 #define LLVM_SUPPORT_RAW_SOCKET_STREAM_H
 
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
-
 #include <atomic>
 #include <chrono>
+#include <memory>
+#include <stdint.h>
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/xxhash.h b/llvm/include/llvm/Support/xxhash.h
index 5f8a7ab360abe..defeca9a0e81d 100644
--- a/llvm/include/llvm/Support/xxhash.h
+++ b/llvm/include/llvm/Support/xxhash.h
@@ -40,6 +40,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include <stdint.h>
 
 namespace llvm {
 
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
index 1cf73a6667786..bcc999069cbf2 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/FormatVariadic.h"
 
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 8ff6ebd230025..b128ee25b213d 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -9,6 +9,8 @@
 #include "llvm/ADT/IntervalMap.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallSet.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/BinaryFormat/Dwarf.h"
 #include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
 #include "llvm/DebugInfo/DWARF/DWARFAttribute.h"
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index df5f7f4697c5c..8d6eea2880fca 100644
--- a/llvm/lib/FileCheck/FileCheck.cpp
+++ b/llvm/lib/FileCheck/FileCheck.cpp
@@ -16,10 +16,11 @@
 #include "llvm/FileCheck/FileCheck.h"
 #include "FileCheckImpl.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Twine.h"
-#include "llvm/Support/CheckedArithmetic.h"
 #include "llvm/Support/FormatVariadic.h"
 #include <cstdint>
 #include <list>
diff --git a/llvm/lib/Support/AMDGPUMetadata.cpp b/llvm/lib/Support/AMDGPUMetadata.cpp
index e24cbde38795b..281576ca35508 100644
--- a/llvm/lib/Support/AMDGPUMetadata.cpp
+++ b/llvm/lib/Support/AMDGPUMetadata.cpp
@@ -14,6 +14,8 @@
 
 #include "llvm/Support/AMDGPUMetadata.h"
 #include "llvm/Support/YAMLTraits.h"
+#include "llvm/Support/raw_ostream.h"
+#include <limits>
 #include <optional>
 
 using namespace llvm::AMDGPU;
diff --git a/llvm/lib/Support/APFixedPoint.cpp b/llvm/lib/Support/APFixedPoint.cpp
index 249c4f1e2153d..35125613fad51 100644
--- a/llvm/lib/Support/APFixedPoint.cpp
+++ b/llvm/lib/Support/APFixedPoint.cpp
@@ -13,7 +13,9 @@
 
 #include "llvm/ADT/APFixedPoint.h"
 #include "llvm/ADT/APFloat.h"
-
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <cmath>
 
 namespace llvm {
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 7f68c5ab9b7cf..35ddece140623 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -18,14 +18,18 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Config/llvm-config.h"
-#include "llvm/Support/Debug.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <array>
 #include <cstring>
+#include <ctype.h>
 #include <limits.h>
 
 #define APFLOAT_DISPATCH_ON_SEMANTICS(METHOD_CALL)                             \
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 24e136fcb9c7f..6d27b3e24ee55 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -16,15 +16,19 @@
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/bit.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Alignment.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/SwapByteOrder.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
 #include <cmath>
+#include <iterator>
+#include <limits>
 #include <optional>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/APSInt.cpp b/llvm/lib/Support/APSInt.cpp
index 5a9f44f304a27..533a09f682c0b 100644
--- a/llvm/lib/Support/APSInt.cpp
+++ b/llvm/lib/Support/APSInt.cpp
@@ -14,6 +14,7 @@
 #include "llvm/ADT/APSInt.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/StringRef.h"
+#include <algorithm>
 #include <cassert>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/ARMAttributeParser.cpp b/llvm/lib/Support/ARMAttributeParser.cpp
index 43a11730b67ea..899cfecafce2f 100644
--- a/llvm/lib/Support/ARMAttributeParser.cpp
+++ b/llvm/lib/Support/ARMAttributeParser.cpp
@@ -7,11 +7,22 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ARMAttributeParser.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/ARMBuildAttributes.h"
+#include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/ELFAttributes.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/raw_ostream.h"
+#include <iterator>
 #include <optional>
+#include <string>
+#include <system_error>
+#include <utility>
 
 using namespace llvm;
 using namespace llvm::ARMBuildAttrs;
diff --git a/llvm/lib/Support/ARMBuildAttrs.cpp b/llvm/lib/Support/ARMBuildAttrs.cpp
index 6ff74e02820da..7dfc1e73116ec 100644
--- a/llvm/lib/Support/ARMBuildAttrs.cpp
+++ b/llvm/lib/Support/ARMBuildAttrs.cpp
@@ -7,10 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ARMBuildAttributes.h"
-#include "llvm/ADT/Twine.h"
-#include "llvm/Support/LEB128.h"
-#include <iomanip>
-#include <sstream>
+#include "llvm/Support/ELFAttributes.h"
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/BalancedPartitioning.cpp b/llvm/lib/Support/BalancedPartitioning.cpp
index 141f0034a23f0..35dd69e5c2f3a 100644
--- a/llvm/lib/Support/BalancedPartitioning.cpp
+++ b/llvm/lib/Support/BalancedPartitioning.cpp
@@ -12,10 +12,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/BalancedPartitioning.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/ThreadPool.h"
+#include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <assert.h>
+#include <cmath>
+#include <iterator>
+#include <utility>
 
 using namespace llvm;
 #define DEBUG_TYPE "balanced-partitioning"
diff --git a/llvm/lib/Support/Base64.cpp b/llvm/lib/Support/Base64.cpp
index 5dab579549781..96aa229135ec3 100644
--- a/llvm/lib/Support/Base64.cpp
+++ b/llvm/lib/Support/Base64.cpp
@@ -8,6 +8,8 @@
 
 #define INVALID_BASE64_BYTE 64
 #include "llvm/Support/Base64.h"
+#include <inttypes.h>
+#include <system_error>
 
 static char decodeBase64Byte(uint8_t Ch) {
   constexpr char Inv = INVALID_BASE64_BYTE;
diff --git a/llvm/lib/Support/BinaryStreamReader.cpp b/llvm/lib/Support/BinaryStreamReader.cpp
index afc00864a5fb6..c11675c7c2f6c 100644
--- a/llvm/lib/Support/BinaryStreamReader.cpp
+++ b/llvm/lib/Support/BinaryStreamReader.cpp
@@ -7,10 +7,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/BinaryStreamReader.h"
-
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/BinaryStreamError.h"
 #include "llvm/Support/BinaryStreamRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/LEB128.h"
+#include "llvm/Support/MathExtras.h"
+#include <stddef.h>
+
+namespace llvm {
+class BinaryStream;
+enum class endianness;
+} // namespace llvm
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/BinaryStreamRef.cpp b/llvm/lib/Support/BinaryStreamRef.cpp
index a6d0bfa10b757..8656bdf4ca634 100644
--- a/llvm/lib/Support/BinaryStreamRef.cpp
+++ b/llvm/lib/Support/BinaryStreamRef.cpp
@@ -9,6 +9,10 @@
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/BinaryByteStream.h"
 
+namespace llvm {
+enum class endianness;
+} // namespace llvm
+
 using namespace llvm;
 
 namespace {
diff --git a/llvm/lib/Support/BinaryStreamWriter.cpp b/llvm/lib/Support/BinaryStreamWriter.cpp
index dff08fee3fefa..f83c8e7e0c776 100644
--- a/llvm/lib/Support/BinaryStreamWriter.cpp
+++ b/llvm/lib/Support/BinaryStreamWriter.cpp
@@ -7,11 +7,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/BinaryStreamWriter.h"
-
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/BinaryStreamReader.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/LEB128.h"
+#include "llvm/Support/MathExtras.h"
+#include <algorithm>
+#include <assert.h>
+
+namespace llvm {
+class WritableBinaryStream;
+enum class endianness;
+} // namespace llvm
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/BranchProbability.cpp b/llvm/lib/Support/BranchProbability.cpp
index e3763449d16cb..653d7fc59606c 100644
--- a/llvm/lib/Support/BranchProbability.cpp
+++ b/llvm/lib/Support/BranchProbability.cpp
@@ -11,12 +11,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/BranchProbability.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <cmath>
+#include <inttypes.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/BuryPointer.cpp b/llvm/lib/Support/BuryPointer.cpp
index 87d2406bbfd1f..b538ab0483789 100644
--- a/llvm/lib/Support/BuryPointer.cpp
+++ b/llvm/lib/Support/BuryPointer.cpp
@@ -9,6 +9,7 @@
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/Compiler.h"
 #include <atomic>
+#include <stddef.h>
 
 namespace llvm {
 
diff --git a/llvm/lib/Support/CRC.cpp b/llvm/lib/Support/CRC.cpp
index 2bc668beed322..4227c540f96a4 100644
--- a/llvm/lib/Support/CRC.cpp
+++ b/llvm/lib/Support/CRC.cpp
@@ -19,9 +19,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/CRC.h"
-
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
+#include <zconf.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/CSKYAttributeParser.cpp b/llvm/lib/Support/CSKYAttributeParser.cpp
index 40ee617b981b2..06a57ff451baa 100644
--- a/llvm/lib/Support/CSKYAttributeParser.cpp
+++ b/llvm/lib/Support/CSKYAttributeParser.cpp
@@ -7,8 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/CSKYAttributeParser.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/DataExtractor.h"
 #include "llvm/Support/Errc.h"
+#include <string>
+#include <system_error>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp
index 4eae08b18c9b5..ba37b0732a7e5 100644
--- a/llvm/lib/Support/CachePruning.cpp
+++ b/llvm/lib/Support/CachePruning.cpp
@@ -11,19 +11,30 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/CachePruning.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Chrono.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
-
-#define DEBUG_TYPE "cache-pruning"
-
+#include <algorithm>
+#include <ctype.h>
 #include <set>
+#include <stddef.h>
+#include <string>
 #include <system_error>
+#include <tuple>
+#include <utility>
+
+#define DEBUG_TYPE "cache-pruning"
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/Caching.cpp b/llvm/lib/Support/Caching.cpp
index 1ef51db218e89..295c9e2f21883 100644
--- a/llvm/lib/Support/Caching.cpp
+++ b/llvm/lib/Support/Caching.cpp
@@ -13,13 +13,16 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Caching.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/Errc.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
+#include <system_error>
 
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
-#include <unistd.h>
 #else
 #include <io.h>
 #endif
diff --git a/llvm/lib/Support/Chrono.cpp b/llvm/lib/Support/Chrono.cpp
index 993d200675fe5..408d230ed93ab 100644
--- a/llvm/lib/Support/Chrono.cpp
+++ b/llvm/lib/Support/Chrono.cpp
@@ -10,6 +10,7 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/lib/Support/CodeGenCoverage.cpp b/llvm/lib/Support/CodeGenCoverage.cpp
index 2e35019e12c16..58f990079cf30 100644
--- a/llvm/lib/Support/CodeGenCoverage.cpp
+++ b/llvm/lib/Support/CodeGenCoverage.cpp
@@ -10,7 +10,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/CodeGenCoverage.h"
-
+#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -18,6 +19,11 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/ScopedPrinter.h"
 #include "llvm/Support/ToolOutputFile.h"
+#include "llvm/Support/raw_ostream.h"
+#include <iterator>
+#include <memory>
+#include <string>
+#include <system_error>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index ecc487a17ccca..82c45bfeae09c 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -16,23 +16,29 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/CommandLine.h"
-
 #include "DebugOptions.h"
-
 #include "llvm-c/Support.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/IntrusiveRefCntPtr.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringMapEntry.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/Config/config.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -41,9 +47,14 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
 #include <cstdlib>
+#include <memory>
 #include <optional>
+#include <string.h>
 #include <string>
+#include <system_error>
+
 using namespace llvm;
 using namespace cl;
 
diff --git a/llvm/lib/Support/Compression.cpp b/llvm/lib/Support/Compression.cpp
index badaf68ab59cd..bc2269cd7522d 100644
--- a/llvm/lib/Support/Compression.cpp
+++ b/llvm/lib/Support/Compression.cpp
@@ -11,12 +11,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Compression.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
+#include <assert.h>
+#include <zconf.h>
 #if LLVM_ENABLE_ZLIB
 #include <zlib.h>
 #endif
diff --git a/llvm/lib/Support/ConvertEBCDIC.cpp b/llvm/lib/Support/ConvertEBCDIC.cpp
index 08eeaa52a6c97..80786cda853c8 100644
--- a/llvm/lib/Support/ConvertEBCDIC.cpp
+++ b/llvm/lib/Support/ConvertEBCDIC.cpp
@@ -14,6 +14,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ConvertEBCDIC.h"
+#include "llvm/ADT/SmallVector.h"
+#include <assert.h>
+#include <stddef.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/ConvertUTFWrapper.cpp b/llvm/lib/Support/ConvertUTFWrapper.cpp
index 3fa7365e72d34..40ba57043ca1e 100644
--- a/llvm/lib/Support/ConvertUTFWrapper.cpp
+++ b/llvm/lib/Support/ConvertUTFWrapper.cpp
@@ -7,10 +7,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/SwapByteOrder.h"
+#include <assert.h>
+#include <stdint.h>
+#include <string.h>
 #include <string>
 #include <vector>
 
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index f53aea177d612..a7943224ea000 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -8,13 +8,17 @@
 
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/ExitCodes.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/thread.h"
 #include <cassert>
+#include <iterator>
 #include <mutex>
+#include <optional>
 #include <setjmp.h>
+#include <stdint.h>
+#include <sysexits.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/DAGDeltaAlgorithm.cpp b/llvm/lib/Support/DAGDeltaAlgorithm.cpp
index f1b730e2b58c4..2682e5ddab5c6 100644
--- a/llvm/lib/Support/DAGDeltaAlgorithm.cpp
+++ b/llvm/lib/Support/DAGDeltaAlgorithm.cpp
@@ -35,9 +35,9 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
-#include <algorithm>
 #include <cassert>
 #include <map>
+
 using namespace llvm;
 
 #define DEBUG_TYPE "dag-delta"
diff --git a/llvm/lib/Support/DJB.cpp b/llvm/lib/Support/DJB.cpp
index b9d159cdb3a62..cd226884959d2 100644
--- a/llvm/lib/Support/DJB.cpp
+++ b/llvm/lib/Support/DJB.cpp
@@ -12,9 +12,11 @@
 
 #include "llvm/Support/DJB.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Unicode.h"
+#include <array>
+#include <assert.h>
+#include <optional>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/DataExtractor.cpp b/llvm/lib/Support/DataExtractor.cpp
index eac3c32cfd3b7..eeeb3032e1924 100644
--- a/llvm/lib/Support/DataExtractor.cpp
+++ b/llvm/lib/Support/DataExtractor.cpp
@@ -12,6 +12,10 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/LEB128.h"
 #include "llvm/Support/SwapByteOrder.h"
+#include <assert.h>
+#include <cstring>
+#include <inttypes.h>
+#include <system_error>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/Debug.cpp b/llvm/lib/Support/Debug.cpp
index 98a9ac4722b50..c0d35a66085fa 100644
--- a/llvm/lib/Support/Debug.cpp
+++ b/llvm/lib/Support/Debug.cpp
@@ -24,13 +24,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Debug.h"
+#include "DebugOptions.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/circular_raw_ostream.h"
 #include "llvm/Support/raw_ostream.h"
-
-#include "DebugOptions.h"
+#include <stddef.h>
+#include <string>
+#include <vector>
 
 #undef isCurrentDebugType
 #undef setCurrentDebugType
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index a5d8a704bdd21..4d463aa2abfcb 100644
--- a/llvm/lib/Support/DebugCounter.cpp
+++ b/llvm/lib/Support/DebugCounter.cpp
@@ -1,9 +1,13 @@
 #include "llvm/Support/DebugCounter.h"
-
 #include "DebugOptions.h"
-
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
+#include "llvm/Support/raw_ostream.h"
+#include <stddef.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/DivisionByConstantInfo.cpp b/llvm/lib/Support/DivisionByConstantInfo.cpp
index b0e503003a680..d9d06c3a05f4e 100644
--- a/llvm/lib/Support/DivisionByConstantInfo.cpp
+++ b/llvm/lib/Support/DivisionByConstantInfo.cpp
@@ -11,6 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/DivisionByConstantInfo.h"
+#include <assert.h>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/DynamicAPInt.cpp b/llvm/lib/Support/DynamicAPInt.cpp
index bfcb97e0cc96a..086bc999d9afc 100644
--- a/llvm/lib/Support/DynamicAPInt.cpp
+++ b/llvm/lib/Support/DynamicAPInt.cpp
@@ -9,6 +9,7 @@
 #include "llvm/ADT/Hashing.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <stddef.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/DynamicLibrary.cpp b/llvm/lib/Support/DynamicLibrary.cpp
index 531c035ab9266..ae9ba4a3c8509 100644
--- a/llvm/lib/Support/DynamicLibrary.cpp
+++ b/llvm/lib/Support/DynamicLibrary.cpp
@@ -12,10 +12,16 @@
 
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm-c/Support.h"
+#include "llvm-c/Types.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringMapEntry.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/Config/config.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Mutex.h"
+#include <assert.h>
 #include <vector>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/ELFAttributeParser.cpp b/llvm/lib/Support/ELFAttributeParser.cpp
index 26c3d54e17ade..c857091bde098 100644
--- a/llvm/lib/Support/ELFAttributeParser.cpp
+++ b/llvm/lib/Support/ELFAttributeParser.cpp
@@ -7,9 +7,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ELFAttributeParser.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/bit.h"
+#include "llvm/Support/ELFAttributes.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/ScopedPrinter.h"
+#include "llvm/Support/raw_ostream.h"
+#include <system_error>
 
 using namespace llvm;
 using namespace llvm::ELFAttrs;
diff --git a/llvm/lib/Support/ELFAttributes.cpp b/llvm/lib/Support/ELFAttributes.cpp
index 63d1448644466..0718ccb596139 100644
--- a/llvm/lib/Support/ELFAttributes.cpp
+++ b/llvm/lib/Support/ELFAttributes.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ELFAttributes.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
 
 using namespace llvm;
diff --git a/llvm/lib/Support/Errno.cpp b/llvm/lib/Support/Errno.cpp
index 60a7e536b6c5c..62267d01486d4 100644
--- a/llvm/lib/Support/Errno.cpp
+++ b/llvm/lib/Support/Errno.cpp
@@ -13,6 +13,7 @@
 #include "llvm/Support/Errno.h"
 #include "llvm/Config/config.h"
 #include <cstring>
+#include <features.h>
 
 #if HAVE_ERRNO_H
 #include <errno.h>
diff --git a/llvm/lib/Support/Error.cpp b/llvm/lib/Support/Error.cpp
index baa3c322e9dae..be8b625407eea 100644
--- a/llvm/lib/Support/Error.cpp
+++ b/llvm/lib/Support/Error.cpp
@@ -11,6 +11,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/ErrorHandling.h"
+#include <string.h>
 #include <system_error>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
index cb42e28c04a86..3ca9732493e49 100644
--- a/llvm/lib/Support/ErrorHandling.cpp
+++ b/llvm/lib/Support/ErrorHandling.cpp
@@ -14,20 +14,19 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm-c/ErrorHandling.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Debug.h"
-#include "llvm/Support/Errc.h"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
-#include "llvm/Support/Threading.h"
-#include "llvm/Support/WindowsError.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
 #include <cstdlib>
 #include <mutex>
 #include <new>
+#include <string.h>
+#include <string>
+#include <sys/types.h>
 
 #if defined(HAVE_UNISTD_H)
 # include <unistd.h>
@@ -238,6 +237,7 @@ void LLVMResetFatalErrorHandler() {
 
 #define WIN32_NO_STATUS
 #include "llvm/Support/Windows/WindowsSupport.h"
+
 #undef WIN32_NO_STATUS
 #include <ntstatus.h>
 #include <winerror.h>
diff --git a/llvm/lib/Support/ExponentialBackoff.cpp b/llvm/lib/Support/ExponentialBackoff.cpp
index 7e68cf67ad385..54c422421c51e 100644
--- a/llvm/lib/Support/ExponentialBackoff.cpp
+++ b/llvm/lib/Support/ExponentialBackoff.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ExponentialBackoff.h"
+#include <algorithm>
 #include <thread>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/FileCollector.cpp b/llvm/lib/Support/FileCollector.cpp
index 29436f85c2f23..f669a7371bcb9 100644
--- a/llvm/lib/Support/FileCollector.cpp
+++ b/llvm/lib/Support/FileCollector.cpp
@@ -8,10 +8,16 @@
 
 #include "llvm/Support/FileCollector.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMapEntry.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
+#include "llvm/Support/raw_ostream.h"
+#include <assert.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/FileOutputBuffer.cpp b/llvm/lib/Support/FileOutputBuffer.cpp
index 58a06a34e8cf3..452bd880aeee8 100644
--- a/llvm/lib/Support/FileOutputBuffer.cpp
+++ b/llvm/lib/Support/FileOutputBuffer.cpp
@@ -11,14 +11,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/FileOutputBuffer.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Memory.h"
 #include "llvm/Support/TimeProfiler.h"
+#include "llvm/Support/raw_ostream.h"
+#include <cstddef>
 #include <system_error>
+#include <utility>
 
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
-#include <unistd.h>
 #else
 #include <io.h>
 #endif
diff --git a/llvm/lib/Support/FloatingPointMode.cpp b/llvm/lib/Support/FloatingPointMode.cpp
index 5a2836eb82434..72cd3df9763f3 100644
--- a/llvm/lib/Support/FloatingPointMode.cpp
+++ b/llvm/lib/Support/FloatingPointMode.cpp
@@ -8,6 +8,8 @@
 
 #include "llvm/ADT/FloatingPointMode.h"
 #include "llvm/ADT/StringExtras.h"
+#include <assert.h>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index 419bf67407684..fc85278ffe6c2 100644
--- a/llvm/lib/Support/FoldingSet.cpp
+++ b/llvm/lib/Support/FoldingSet.cpp
@@ -13,12 +13,16 @@
 
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Allocator.h"
-#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/MemAlloc.h"
 #include "llvm/Support/SwapByteOrder.h"
 #include <cassert>
 #include <cstring>
+#include <memory>
+#include <stdlib.h>
+
 using namespace llvm;
 
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Support/FormatVariadic.cpp b/llvm/lib/Support/FormatVariadic.cpp
index 3c07a80a00ae6..c4017ad4322ed 100644
--- a/llvm/lib/Support/FormatVariadic.cpp
+++ b/llvm/lib/Support/FormatVariadic.cpp
@@ -6,6 +6,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/FormatVariadic.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <optional>
 
diff --git a/llvm/lib/Support/FormattedStream.cpp b/llvm/lib/Support/FormattedStream.cpp
index c50530e76efc0..458ff59e78dea 100644
--- a/llvm/lib/Support/FormattedStream.cpp
+++ b/llvm/lib/Support/FormattedStream.cpp
@@ -11,6 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/FormattedStream.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Unicode.h"
diff --git a/llvm/lib/Support/GlobPattern.cpp b/llvm/lib/Support/GlobPattern.cpp
index 7004adf461a0c..73e70576db271 100644
--- a/llvm/lib/Support/GlobPattern.cpp
+++ b/llvm/lib/Support/GlobPattern.cpp
@@ -11,8 +11,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/GlobPattern.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/Errc.h"
+#include <limits>
+#include <stdint.h>
+#include <string>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/GraphWriter.cpp b/llvm/lib/Support/GraphWriter.cpp
index e353ab86b5e80..08e9b4d0288ca 100644
--- a/llvm/lib/Support/GraphWriter.cpp
+++ b/llvm/lib/Support/GraphWriter.cpp
@@ -11,14 +11,11 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/GraphWriter.h"
-
 #include "DebugOptions.h"
-
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Config/config.h"
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
@@ -31,6 +28,8 @@
 #include "llvm/Support/ManagedStatic.h"
 #endif
 
+#include <algorithm>
+#include <optional>
 #include <string>
 #include <system_error>
 #include <vector>
diff --git a/llvm/lib/Support/InitLLVM.cpp b/llvm/lib/Support/InitLLVM.cpp
index b7e463a19122d..63868fa554ee5 100644
--- a/llvm/lib/Support/InitLLVM.cpp
+++ b/llvm/lib/Support/InitLLVM.cpp
@@ -8,13 +8,9 @@
 
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/AutoConvert.h"
-#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
-#include "llvm/Support/SwapByteOrder.h"
 
 #ifdef _WIN32
 #include "llvm/Support/Windows/WindowsSupport.h"
diff --git a/llvm/lib/Support/JSON.cpp b/llvm/lib/Support/JSON.cpp
index a5c617bb4a076..6db33876060c0 100644
--- a/llvm/lib/Support/JSON.cpp
+++ b/llvm/lib/Support/JSON.cpp
@@ -7,7 +7,9 @@
 //===---------------------------------------------------------------------===//
 
 #include "llvm/Support/JSON.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/Error.h"
@@ -16,7 +18,9 @@
 #include "llvm/Support/raw_ostream.h"
 #include <cctype>
 #include <cerrno>
+#include <cstdlib>
 #include <optional>
+#include <string.h>
 
 namespace llvm {
 namespace json {
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp
index 8e31e0ced2d73..bcc4c3dd4afbe 100644
--- a/llvm/lib/Support/KnownBits.cpp
+++ b/llvm/lib/Support/KnownBits.cpp
@@ -13,8 +13,12 @@
 
 #include "llvm/Support/KnownBits.h"
 #include "llvm/Support/Debug.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
 #include <cassert>
+#include <initializer_list>
+#include <stdint.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/LineIterator.cpp b/llvm/lib/Support/LineIterator.cpp
index caf88d7dfd4af..8d8d4d7438528 100644
--- a/llvm/lib/Support/LineIterator.cpp
+++ b/llvm/lib/Support/LineIterator.cpp
@@ -8,6 +8,8 @@
 
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include <assert.h>
+#include <stddef.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp
index ea040ccf22b99..25a5d8392e519 100644
--- a/llvm/lib/Support/LockFileManager.cpp
+++ b/llvm/lib/Support/LockFileManager.cpp
@@ -9,6 +9,7 @@
 #include "llvm/Support/LockFileManager.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/ExponentialBackoff.h"
@@ -19,12 +20,8 @@
 #include "llvm/Support/raw_ostream.h"
 #include <cerrno>
 #include <chrono>
-#include <ctime>
 #include <memory>
-#include <sys/stat.h>
-#include <sys/types.h>
 #include <system_error>
-#include <thread>
 #include <tuple>
 
 #ifdef _WIN32
diff --git a/llvm/lib/Support/MD5.cpp b/llvm/lib/Support/MD5.cpp
index ef7f559adf064..8e773a75075fa 100644
--- a/llvm/lib/Support/MD5.cpp
+++ b/llvm/lib/Support/MD5.cpp
@@ -47,6 +47,10 @@
 #include <cstdint>
 #include <cstring>
 
+namespace llvm {
+template <typename T> class SmallVectorImpl;
+} // namespace llvm
+
 // The basic MD5 functions.
 
 // F and G are optimized compared to their RFC 1321 definitions for
diff --git a/llvm/lib/Support/MSP430AttributeParser.cpp b/llvm/lib/Support/MSP430AttributeParser.cpp
index 27694b8f60f36..bfc69cb2bb3ce 100644
--- a/llvm/lib/Support/MSP430AttributeParser.cpp
+++ b/llvm/lib/Support/MSP430AttributeParser.cpp
@@ -8,7 +8,6 @@
 
 #include "llvm/Support/MSP430AttributeParser.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/ErrorHandling.h"
 
 using namespace llvm;
 using namespace llvm::MSP430Attrs;
diff --git a/llvm/lib/Support/ManagedStatic.cpp b/llvm/lib/Support/ManagedStatic.cpp
index a6ae67066ea04..3a27412d7db86 100644
--- a/llvm/lib/Support/ManagedStatic.cpp
+++ b/llvm/lib/Support/ManagedStatic.cpp
@@ -11,10 +11,10 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Config/config.h"
 #include "llvm/Support/Threading.h"
 #include <cassert>
 #include <mutex>
+
 using namespace llvm;
 
 static const ManagedStaticBase *StaticList = nullptr;
diff --git a/llvm/lib/Support/MemoryBuffer.cpp b/llvm/lib/Support/MemoryBuffer.cpp
index fb7e804fd7e84..7cab8d8ed42bc 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -19,16 +19,18 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
-#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/SmallVectorMemoryBuffer.h"
 #include <algorithm>
 #include <cassert>
+#include <cstdlib>
 #include <cstring>
 #include <new>
 #include <sys/types.h>
 #include <system_error>
+#include <utility>
+
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 #include <unistd.h>
 #else
diff --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp
index 3b9273e1eaadb..c3facffd2f848 100644
--- a/llvm/lib/Support/NativeFormatting.cpp
+++ b/llvm/lib/Support/NativeFormatting.cpp
@@ -10,11 +10,16 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/bit.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/Format.h"
-#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
-
+#include <algorithm>
+#include <assert.h>
 #include <cmath>
+#include <cstring>
+#include <iterator>
+#include <type_traits>
 
 #if defined(_WIN32) && !defined(__MINGW32__)
 #include <float.h> // For _fpclass in llvm::write_double.
diff --git a/llvm/lib/Support/OptimizedStructLayout.cpp b/llvm/lib/Support/OptimizedStructLayout.cpp
index 7b21f927a3462..ee512ecadabc7 100644
--- a/llvm/lib/Support/OptimizedStructLayout.cpp
+++ b/llvm/lib/Support/OptimizedStructLayout.cpp
@@ -11,7 +11,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/OptimizedStructLayout.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <algorithm>
 #include <optional>
+#include <string.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/PGOOptions.cpp b/llvm/lib/Support/PGOOptions.cpp
index 5981dff9e0946..b7481dc669404 100644
--- a/llvm/lib/Support/PGOOptions.cpp
+++ b/llvm/lib/Support/PGOOptions.cpp
@@ -8,6 +8,8 @@
 
 #include "llvm/Support/PGOOptions.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include <assert.h>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/Parallel.cpp b/llvm/lib/Support/Parallel.cpp
index af35947192c0d..45c2221754bc9 100644
--- a/llvm/lib/Support/Parallel.cpp
+++ b/llvm/lib/Support/Parallel.cpp
@@ -7,14 +7,16 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Parallel.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Threading.h"
-
 #include <atomic>
 #include <deque>
 #include <future>
+#include <memory>
 #include <thread>
+#include <utility>
 #include <vector>
 
 llvm::ThreadPoolStrategy llvm::parallel::strategy;
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 4db9bc80b415b..2d388532a48ef 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -12,17 +12,30 @@
 
 #include "llvm/Support/Path.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/ScopeExit.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Config/config.h"
 #include "llvm/Config/llvm-config.h"
-#include "llvm/Support/Endian.h"
 #include "llvm/Support/Errc.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FileSystem/UniqueID.h"
+#include "llvm/Support/MD5.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Signals.h"
+#include <algorithm>
+#include <assert.h>
 #include <cctype>
+#include <stdint.h>
+#include <sys/types.h>
+#include <system_error>
+#include <utility>
+#include <vector>
 
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 #include <unistd.h>
diff --git a/llvm/lib/Support/PluginLoader.cpp b/llvm/lib/Support/PluginLoader.cpp
index cbe413ce25562..a52b70e669b34 100644
--- a/llvm/lib/Support/PluginLoader.cpp
+++ b/llvm/lib/Support/PluginLoader.cpp
@@ -15,7 +15,9 @@
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/Mutex.h"
 #include "llvm/Support/raw_ostream.h"
+#include <assert.h>
 #include <vector>
+
 using namespace llvm;
 
 namespace {
diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp
index 54462f23c8424..ca2168db04d2f 100644
--- a/llvm/lib/Support/Process.cpp
+++ b/llvm/lib/Support/Process.cpp
@@ -11,15 +11,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Process.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
-#include "llvm/Support/Program.h"
-
+#include <assert.h>
 #include <optional>
 #include <stdlib.h> // for _Exit
 
diff --git a/llvm/lib/Support/Program.cpp b/llvm/lib/Support/Program.cpp
index 181f68cfbb8c3..27ce5d3b8a439 100644
--- a/llvm/lib/Support/Program.cpp
+++ b/llvm/lib/Support/Program.cpp
@@ -11,9 +11,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Program.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/raw_ostream.h"
+#include <assert.h>
+
 using namespace llvm;
 using namespace sys;
 
diff --git a/llvm/lib/Support/RISCVAttributeParser.cpp b/llvm/lib/Support/RISCVAttributeParser.cpp
index 20392e4bae19f..06202a149c9cb 100644
--- a/llvm/lib/Support/RISCVAttributeParser.cpp
+++ b/llvm/lib/Support/RISCVAttributeParser.cpp
@@ -7,7 +7,10 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/RISCVAttributeParser.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/DataExtractor.h"
+#include <string>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/RISCVISAUtils.cpp b/llvm/lib/Support/RISCVISAUtils.cpp
index d6b002e66e7ab..5985cb5c02a09 100644
--- a/llvm/lib/Support/RISCVISAUtils.cpp
+++ b/llvm/lib/Support/RISCVISAUtils.cpp
@@ -13,6 +13,7 @@
 #include "llvm/Support/RISCVISAUtils.h"
 #include "llvm/ADT/StringExtras.h"
 #include <cassert>
+#include <stddef.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/RandomNumberGenerator.cpp b/llvm/lib/Support/RandomNumberGenerator.cpp
index 2959fc2bfed17..e7f96b6418891 100644
--- a/llvm/lib/Support/RandomNumberGenerator.cpp
+++ b/llvm/lib/Support/RandomNumberGenerator.cpp
@@ -13,18 +13,22 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/RandomNumberGenerator.h"
-
 #include "DebugOptions.h"
-
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/raw_ostream.h"
+#include <errno.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <vector>
 #ifdef _WIN32
 #include "llvm/Support/Windows/WindowsSupport.h"
 #else
-#include "Unix/Unix.h"
 #endif
 
 using namespace llvm;
diff --git a/llvm/lib/Support/SHA1.cpp b/llvm/lib/Support/SHA1.cpp
index 412f894492bfe..5cd2dcd08c9dc 100644
--- a/llvm/lib/Support/SHA1.cpp
+++ b/llvm/lib/Support/SHA1.cpp
@@ -17,8 +17,11 @@
 #include "llvm/Support/SHA1.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/SwapByteOrder.h"
+#include <algorithm>
+#include <assert.h>
 #include <string.h>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/SHA256.cpp b/llvm/lib/Support/SHA256.cpp
index a8019002499ca..dfe1e9a6d25ae 100644
--- a/llvm/lib/Support/SHA256.cpp
+++ b/llvm/lib/Support/SHA256.cpp
@@ -22,8 +22,11 @@
 #include "llvm/Support/SHA256.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/SwapByteOrder.h"
+#include <algorithm>
+#include <assert.h>
 #include <string.h>
 
 namespace llvm {
diff --git a/llvm/lib/Support/ScaledNumber.cpp b/llvm/lib/Support/ScaledNumber.cpp
index 85d7afbea5c69..e43b163a91474 100644
--- a/llvm/lib/Support/ScaledNumber.cpp
+++ b/llvm/lib/Support/ScaledNumber.cpp
@@ -12,9 +12,12 @@
 
 #include "llvm/Support/ScaledNumber.h"
 #include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <stddef.h>
 
 using namespace llvm;
 using namespace llvm::ScaledNumbers;
diff --git a/llvm/lib/Support/ScopedPrinter.cpp b/llvm/lib/Support/ScopedPrinter.cpp
index a17e397c0aa58..ddc8e7dd820a6 100644
--- a/llvm/lib/Support/ScopedPrinter.cpp
+++ b/llvm/lib/Support/ScopedPrinter.cpp
@@ -1,6 +1,8 @@
 #include "llvm/Support/ScopedPrinter.h"
-
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/Support/Format.h"
+#include <optional>
+#include <utility>
 
 using namespace llvm::support;
 
diff --git a/llvm/lib/Support/Signals.cpp b/llvm/lib/Support/Signals.cpp
index 9f9030e79d104..a6b8eace03709 100644
--- a/llvm/lib/Support/Signals.cpp
+++ b/llvm/lib/Support/Signals.cpp
@@ -12,12 +12,16 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Signals.h"
-
 #include "DebugOptions.h"
-
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Config/llvm-config.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/Support/Allocator.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileUtilities.h"
@@ -30,7 +34,12 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <array>
+#include <atomic>
 #include <cmath>
+#include <memory>
+#include <optional>
+#include <stdlib.h>
+#include <system_error>
 #include <vector>
 
 //===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Support/SipHash.cpp b/llvm/lib/Support/SipHash.cpp
index 68545913a4f59..49783dbbff193 100644
--- a/llvm/lib/Support/SipHash.cpp
+++ b/llvm/lib/Support/SipHash.cpp
@@ -19,6 +19,7 @@
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Endian.h"
 #include <cstdint>
+#include <stddef.h>
 
 using namespace llvm;
 using namespace support;
diff --git a/llvm/lib/Support/SlowDynamicAPInt.cpp b/llvm/lib/Support/SlowDynamicAPInt.cpp
index 7964a3d59daf5..ab361891419a7 100644
--- a/llvm/lib/Support/SlowDynamicAPInt.cpp
+++ b/llvm/lib/Support/SlowDynamicAPInt.cpp
@@ -8,8 +8,12 @@
 
 #include "llvm/ADT/SlowDynamicAPInt.h"
 #include "llvm/ADT/Hashing.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include <algorithm>
+#include <assert.h>
+#include <functional>
 
 using namespace llvm;
 using namespace detail;
diff --git a/llvm/lib/Support/SmallPtrSet.cpp b/llvm/lib/Support/SmallPtrSet.cpp
index cbb87ea8717cf..0e59c11125023 100644
--- a/llvm/lib/Support/SmallPtrSet.cpp
+++ b/llvm/lib/Support/SmallPtrSet.cpp
@@ -13,6 +13,7 @@
 
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/MemAlloc.h"
 #include <algorithm>
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp
index b6ce37842040b..d20b49f5900f8 100644
--- a/llvm/lib/Support/SmallVector.cpp
+++ b/llvm/lib/Support/SmallVector.cpp
@@ -12,8 +12,10 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemAlloc.h"
 #include <cstdint>
+#include <string>
 #ifdef LLVM_ENABLE_EXCEPTIONS
 #include <stdexcept>
 #endif
diff --git a/llvm/lib/Support/SourceMgr.cpp b/llvm/lib/Support/SourceMgr.cpp
index 3f97213d86c05..186ff8d3ab782 100644
--- a/llvm/lib/Support/SourceMgr.cpp
+++ b/llvm/lib/Support/SourceMgr.cpp
@@ -31,6 +31,7 @@
 #include <cstddef>
 #include <limits>
 #include <memory>
+#include <stdint.h>
 #include <string>
 #include <utility>
 
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index 7a23421eaeb89..1bdf2b0bde9f5 100644
--- a/llvm/lib/Support/SpecialCaseList.cpp
+++ b/llvm/lib/Support/SpecialCaseList.cpp
@@ -14,10 +14,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/SpecialCaseList.h"
+#include "llvm/ADT/StringMapEntry.h"
+#include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/Support/Errc.h"
+#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/VirtualFileSystem.h"
+#include <optional>
 #include <stdio.h>
+#include <string.h>
 #include <string>
 #include <system_error>
 #include <utility>
diff --git a/llvm/lib/Support/Statistic.cpp b/llvm/lib/Support/Statistic.cpp
index 24ef3e9abaebc..b4c557d09af6c 100644
--- a/llvm/lib/Support/Statistic.cpp
+++ b/llvm/lib/Support/Statistic.cpp
@@ -21,13 +21,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/Statistic.h"
-
 #include "DebugOptions.h"
-
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/iterator_range.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/Mutex.h"
@@ -35,7 +34,11 @@
 #include "llvm/Support/YAMLTraits.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
+#include <assert.h>
 #include <cstring>
+#include <inttypes.h>
+#include <string>
+
 using namespace llvm;
 
 /// -stats - Command line option to cause transformations to emit stats about
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp
index 6ae26267337b1..bcb65f9a69824 100644
--- a/llvm/lib/Support/StringExtras.cpp
+++ b/llvm/lib/Support/StringExtras.cpp
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/STLFunctionalExtras.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cctype>
diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp
index 432e1fc343f1f..9c387021e9dac 100644
--- a/llvm/lib/Support/StringMap.cpp
+++ b/llvm/lib/Support/StringMap.cpp
@@ -11,7 +11,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/MemAlloc.h"
 #include "llvm/Support/ReverseIteration.h"
 #include "llvm/Support/xxhash.h"
 
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index f1042131a89cb..f1056d8a5a492 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -9,11 +9,15 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/Hashing.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/edit_distance.h"
 #include "llvm/Support/Error.h"
 #include <bitset>
+#include <limits.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/StringSaver.cpp b/llvm/lib/Support/StringSaver.cpp
index 4a616d7348320..1ed3c2cb61472 100644
--- a/llvm/lib/Support/StringSaver.cpp
+++ b/llvm/lib/Support/StringSaver.cpp
@@ -7,8 +7,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/StringSaver.h"
-
 #include "llvm/ADT/SmallString.h"
+#include <string.h>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/SuffixTree.cpp b/llvm/lib/Support/SuffixTree.cpp
index 5e58310e1128b..5a239599f123c 100644
--- a/llvm/lib/Support/SuffixTree.cpp
+++ b/llvm/lib/Support/SuffixTree.cpp
@@ -11,9 +11,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/SuffixTree.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Allocator.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/SuffixTreeNode.h"
+#include <assert.h>
+#include <new>
+#include <stddef.h>
+#include <tuple>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/SuffixTreeNode.cpp b/llvm/lib/Support/SuffixTreeNode.cpp
index 9f1f94a39895e..b6048d889e8f6 100644
--- a/llvm/lib/Support/SuffixTreeNode.cpp
+++ b/llvm/lib/Support/SuffixTreeNode.cpp
@@ -12,7 +12,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/SuffixTreeNode.h"
-#include "llvm/Support/Casting.h"
+#include <assert.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/TarWriter.cpp b/llvm/lib/Support/TarWriter.cpp
index c7a744f0fc98c..61a313d808ee6 100644
--- a/llvm/lib/Support/TarWriter.cpp
+++ b/llvm/lib/Support/TarWriter.cpp
@@ -23,9 +23,15 @@
 
 #include "llvm/Support/TarWriter.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/Path.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <system_error>
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp
index 27e0f220ac4ed..b92fc6e688d86 100644
--- a/llvm/lib/Support/ThreadPool.cpp
+++ b/llvm/lib/Support/ThreadPool.cpp
@@ -11,12 +11,15 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ThreadPool.h"
-
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Config/llvm-config.h"
-
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/thread.h"
+#include <algorithm>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index 7cc7ba44cc72d..5628fe3635da2 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -14,12 +14,8 @@
 #include "llvm/Support/Threading.h"
 #include "llvm/Config/config.h"
 #include "llvm/Config/llvm-config.h"
-
-#include <cassert>
-#include <errno.h>
+#include <algorithm>
 #include <optional>
-#include <stdlib.h>
-#include <string.h>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/TimeProfiler.cpp b/llvm/lib/Support/TimeProfiler.cpp
index c2014028ddadc..2d0aaecc7d435 100644
--- a/llvm/lib/Support/TimeProfiler.cpp
+++ b/llvm/lib/Support/TimeProfiler.cpp
@@ -13,17 +13,27 @@
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/STLFunctionalExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringMapEntry.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Threading.h"
+#include "llvm/Support/raw_ostream.h"
 #include <algorithm>
 #include <cassert>
 #include <chrono>
 #include <memory>
 #include <mutex>
+#include <stddef.h>
+#include <stdint.h>
 #include <string>
+#include <system_error>
+#include <utility>
 #include <vector>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index c1b0fdbc077bb..bfab4988cf7aa 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -11,12 +11,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Timer.h"
-
 #include "DebugOptions.h"
-
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/Statistic.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringMapEntry.h"
+#include "llvm/ADT/iterator.h"
 #include "llvm/Config/config.h"
+#include "llvm/Support/Chrono.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Format.h"
@@ -26,7 +28,13 @@
 #include "llvm/Support/Signposts.h"
 #include "llvm/Support/YAMLTraits.h"
 #include "llvm/Support/raw_ostream.h"
+#include <chrono>
+#include <inttypes.h>
 #include <limits>
+#include <ratio>
+#include <stddef.h>
+#include <system_error>
+#include <utility>
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
diff --git a/llvm/lib/Support/Twine.cpp b/llvm/lib/Support/Twine.cpp
index 495b9cf2dbd68..ac0b099d74838 100644
--- a/llvm/lib/Support/Twine.cpp
+++ b/llvm/lib/Support/Twine.cpp
@@ -8,10 +8,10 @@
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/SmallString.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
+
 using namespace llvm;
 
 std::string Twine::str() const {
diff --git a/llvm/lib/Support/TypeSize.cpp b/llvm/lib/Support/TypeSize.cpp
index 43346b81cd676..bda5a0138516d 100644
--- a/llvm/lib/Support/TypeSize.cpp
+++ b/llvm/lib/Support/TypeSize.cpp
@@ -7,12 +7,13 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/TypeSize.h"
+#include "DebugOptions.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/WithColor.h"
 
-#include "DebugOptions.h"
-
 using namespace llvm;
 
 #ifndef STRICT_FIXED_SIZE_VECTORS
diff --git a/llvm/lib/Support/Unicode.cpp b/llvm/lib/Support/Unicode.cpp
index 288b75c872e17..4776480aa102e 100644
--- a/llvm/lib/Support/Unicode.cpp
+++ b/llvm/lib/Support/Unicode.cpp
@@ -12,8 +12,10 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Unicode.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/UnicodeCharRanges.h"
+#include <stddef.h>
 
 namespace llvm {
 namespace sys {
diff --git a/llvm/lib/Support/UnicodeNameToCodepoint.cpp b/llvm/lib/Support/UnicodeNameToCodepoint.cpp
index 8d66348cfaba6..49076bcfe1661 100644
--- a/llvm/lib/Support/UnicodeNameToCodepoint.cpp
+++ b/llvm/lib/Support/UnicodeNameToCodepoint.cpp
@@ -13,9 +13,22 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Unicode.h"
+#include <algorithm>
+#include <assert.h>
+#include <cstddef>
+#include <cstdint>
+#include <iterator>
+#include <optional>
+#include <string>
+#include <tuple>
+#include <utility>
+#include <vector>
 
 namespace llvm {
 namespace sys {
diff --git a/llvm/lib/Support/UnicodeNameToCodepointGenerated.cpp b/llvm/lib/Support/UnicodeNameToCodepointGenerated.cpp
index bfd51a5434cfa..31362fd08bdea 100644
--- a/llvm/lib/Support/UnicodeNameToCodepointGenerated.cpp
+++ b/llvm/lib/Support/UnicodeNameToCodepointGenerated.cpp
@@ -62,9 +62,9 @@ use or other dealings in these Data Files or Software without prior
 written authorization of the copyright holder.
 */
 
-#include "llvm/Support/Compiler.h"
 #include <cstddef>
 #include <cstdint>
+
 namespace llvm {
 namespace sys {
 namespace unicode {
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index 84b10ff5d1d08..48a164eeebe8d 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -13,8 +13,8 @@
 #include "Unix.h"
 #include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Config/config.h"
-#include <mutex>
 #include <optional>
 #if HAVE_FCNTL_H
 #include <fcntl.h>
diff --git a/llvm/lib/Support/Unix/Unix.h b/llvm/lib/Support/Unix/Unix.h
index 1599241a344af..40d8814e0762c 100644
--- a/llvm/lib/Support/Unix/Unix.h
+++ b/llvm/lib/Support/Unix/Unix.h
@@ -18,11 +18,11 @@
 //===          is guaranteed to work on all UNIX variants.
 //===----------------------------------------------------------------------===//
 
+#include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/ErrorHandling.h"
-#include <algorithm>
 #include <assert.h>
 #include <cerrno>
 #include <cstdio>
diff --git a/llvm/lib/Support/VirtualFileSystem.cpp b/llvm/lib/Support/VirtualFileSystem.cpp
index 9d21eba9df635..712d4d2498481 100644
--- a/llvm/lib/Support/VirtualFileSystem.cpp
+++ b/llvm/lib/Support/VirtualFileSystem.cpp
@@ -13,31 +13,31 @@
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Hashing.h"
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator_range.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Debug.h"
 #include "llvm/Support/Errc.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FileSystem/UniqueID.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/YAMLParser.h"
 #include "llvm/Support/raw_ostream.h"
-#include <algorithm>
 #include <atomic>
 #include <cassert>
 #include <cstdint>
diff --git a/llvm/lib/Support/WithColor.cpp b/llvm/lib/Support/WithColor.cpp
index abc9fb3e5d606..847f5f72e1589 100644
--- a/llvm/lib/Support/WithColor.cpp
+++ b/llvm/lib/Support/WithColor.cpp
@@ -7,12 +7,12 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/WithColor.h"
-
 #include "DebugOptions.h"
-
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Error.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ManagedStatic.h"
+#include <utility>
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index fdd0ed6e682eb..d21f54a49886a 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -19,9 +19,12 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/ADT/iterator.h"
+#include "llvm/Support/Casting.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/MemoryBufferRef.h"
 #include "llvm/Support/SMLoc.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/Support/Unicode.h"
@@ -29,6 +32,7 @@
 #include <cassert>
 #include <cstddef>
 #include <cstdint>
+#include <functional>
 #include <map>
 #include <memory>
 #include <string>
diff --git a/llvm/lib/Support/YAMLTraits.cpp b/llvm/lib/Support/YAMLTraits.cpp
index 56b557646100b..92e28c439ddc5 100644
--- a/llvm/lib/Support/YAMLTraits.cpp
+++ b/llvm/lib/Support/YAMLTraits.cpp
@@ -10,6 +10,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringMapEntry.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Support/Casting.h"
@@ -21,10 +22,10 @@
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/Support/YAMLParser.h"
 #include "llvm/Support/raw_ostream.h"
-#include <algorithm>
 #include <cassert>
 #include <cstdint>
 #include <cstring>
+#include <inttypes.h>
 #include <string>
 #include <vector>
 
diff --git a/llvm/lib/Support/Z3Solver.cpp b/llvm/lib/Support/Z3Solver.cpp
index 5a34ff160f6cf..f1984de9ffef9 100644
--- a/llvm/lib/Support/Z3Solver.cpp
+++ b/llvm/lib/Support/Z3Solver.cpp
@@ -6,10 +6,11 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/ScopeExit.h"
-#include "llvm/Config/config.h"
-#include "llvm/Support/NativeFormatting.h"
+#include "llvm/Config/llvm-config.h"
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/SMTAPI.h"
+#include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
 
@@ -17,6 +18,8 @@ using namespace llvm;
 
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/Twine.h"
+#include <set>
+#include <z3.h>
 
 #include <set>
 
diff --git a/llvm/lib/Support/circular_raw_ostream.cpp b/llvm/lib/Support/circular_raw_ostream.cpp
index acd230704ff8d..9371f52e6b758 100644
--- a/llvm/lib/Support/circular_raw_ostream.cpp
+++ b/llvm/lib/Support/circular_raw_ostream.cpp
@@ -12,6 +12,8 @@
 
 #include "llvm/Support/circular_raw_ostream.h"
 #include <algorithm>
+#include <cstring>
+
 using namespace llvm;
 
 void circular_raw_ostream::write_impl(const char *Ptr, size_t Size) {
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 2ce54faa9857e..cde8cbf314659 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -11,11 +11,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
-#include "llvm/Support/AutoConvert.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Duration.h"
+#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Format.h"
@@ -25,8 +28,11 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/Program.h"
 #include <algorithm>
+#include <cassert>
 #include <cerrno>
 #include <cstdio>
+#include <inttypes.h>
+#include <iterator>
 #include <sys/stat.h>
 
 // <fcntl.h> may provide O_BINARY.
diff --git a/llvm/lib/Support/raw_socket_stream.cpp b/llvm/lib/Support/raw_socket_stream.cpp
index 04b3233084a41..a1304c4ebdcf9 100644
--- a/llvm/lib/Support/raw_socket_stream.cpp
+++ b/llvm/lib/Support/raw_socket_stream.cpp
@@ -15,11 +15,13 @@
 #include "llvm/Config/config.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
-
 #include <atomic>
 #include <fcntl.h>
 #include <functional>
-#include <thread>
+#include <string.h>
+#include <sys/types.h>
+#include <system_error>
+#include <utility>
 
 #ifndef _WIN32
 #include <poll.h>
diff --git a/llvm/lib/Support/xxhash.cpp b/llvm/lib/Support/xxhash.cpp
index cdb76d57e2c1d..e400af63cf486 100644
--- a/llvm/lib/Support/xxhash.cpp
+++ b/llvm/lib/Support/xxhash.cpp
@@ -42,9 +42,10 @@
 // (June 2024).
 
 #include "llvm/Support/xxhash.h"
+#include "llvm/ADT/bit.h"
 #include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"
-
+#include <assert.h>
 #include <stdlib.h>
 
 #if !defined(LLVM_XXH_USE_NEON)
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 0544fc4f406bb..4fceb6042fd22 100644
--- a/llvm/tools/llvm-objdump/MachODump.cpp
+++ b/llvm/tools/llvm-objdump/MachODump.cpp
@@ -17,6 +17,7 @@
 #include "llvm-c/Disassembler.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/BinaryFormat/MachO.h"
 #include "llvm/Config/config.h"
 #include "llvm/DebugInfo/DIContext.h"
diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp
index 51214524adeef..fdb6a2156111a 100644
--- a/llvm/tools/llvm-rc/llvm-rc.cpp
+++ b/llvm/tools/llvm-rc/llvm-rc.cpp
@@ -17,6 +17,7 @@
 #include "ResourceScriptStmt.h"
 #include "ResourceScriptToken.h"
 
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Object/WindowsResource.h"
 #include "llvm/Option/Arg.h"
diff --git a/llvm/tools/llvm-xray/xray-account.cpp b/llvm/tools/llvm-xray/xray-account.cpp
index 24a3552cfb91e..62f2aebb653ce 100644
--- a/llvm/tools/llvm-xray/xray-account.cpp
+++ b/llvm/tools/llvm-xray/xray-account.cpp
@@ -19,6 +19,7 @@
 #include "xray-account.h"
 #include "xray-registry.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/XRay/InstrumentationMap.h"
 #include "llvm/XRay/Trace.h"
diff --git a/llvm/tools/llvm-xray/xray-graph-diff.cpp b/llvm/tools/llvm-xray/xray-graph-diff.cpp
index b5c63ab0a9183..cb170e1deff66 100644
--- a/llvm/tools/llvm-xray/xray-graph-diff.cpp
+++ b/llvm/tools/llvm-xray/xray-graph-diff.cpp
@@ -20,6 +20,7 @@
 #include "xray-registry.h"
 
 #include "xray-color-helper.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/XRay/Trace.h"
diff --git a/llvm/tools/llvm-xray/xray-graph.cpp b/llvm/tools/llvm-xray/xray-graph.cpp
index de67993d75901..00b7d8167d908 100644
--- a/llvm/tools/llvm-xray/xray-graph.cpp
+++ b/llvm/tools/llvm-xray/xray-graph.cpp
@@ -14,6 +14,7 @@
 #include "xray-graph.h"
 #include "xray-registry.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/XRay/InstrumentationMap.h"
 #include "llvm/XRay/Trace.h"
 
diff --git a/llvm/unittests/TargetParser/Host.cpp b/llvm/unittests/TargetParser/Host.cpp
index f8dd1d3a60a00..3ec12bbf64d6b 100644
--- a/llvm/unittests/TargetParser/Host.cpp
+++ b/llvm/unittests/TargetParser/Host.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/TargetParser/Host.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp
index 9cf3a3164dfec..d649e97cc036f 100644
--- a/llvm/utils/FileCheck/FileCheck.cpp
+++ b/llvm/utils/FileCheck/FileCheck.cpp
@@ -16,6 +16,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/FileCheck/FileCheck.h"
+#include "llvm/ADT/SmallString.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/MemoryBuffer.h"
diff --git a/mlir/include/mlir/Analysis/Presburger/Fraction.h b/mlir/include/mlir/Analysis/Presburger/Fraction.h
index f4f1be97147bf..585a6d48506d2 100644
--- a/mlir/include/mlir/Analysis/Presburger/Fraction.h
+++ b/mlir/include/mlir/Analysis/Presburger/Fraction.h
@@ -15,6 +15,7 @@
 #define MLIR_ANALYSIS_PRESBURGER_FRACTION_H
 
 #include "llvm/ADT/DynamicAPInt.h"
+#include "llvm/Support/raw_ostream.h"
 
 namespace mlir {
 namespace presburger {



More information about the Mlir-commits mailing list