[clang] [lld] [llvm] [NFC] Cleanup in Support headers. (PR #104825)

Daniil Fukalov via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 03:01:40 PDT 2024


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

>From cce13227c78d3d1831fb8773fc52005fabd412c6 Mon Sep 17 00:00:00 2001
From: dfukalov <dfukalov at gmail.com>
Date: Mon, 19 Aug 2024 20:02:52 +0200
Subject: [PATCH 1/4] [NFC] Cleanup in Support headers.

Remove unused directly includes and forward declarations in Support headers.
---
 clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp          | 1 +
 clang/lib/Format/Format.cpp                                 | 1 +
 clang/lib/Format/FormatTokenSource.h                        | 1 +
 clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp   | 1 +
 clang/tools/driver/driver.cpp                               | 1 +
 clang/unittests/Format/MacroCallReconstructorTest.cpp       | 1 +
 lld/ELF/Writer.cpp                                          | 1 +
 lld/MachO/BPSectionOrderer.cpp                              | 1 +
 lld/MachO/Dwarf.cpp                                         | 1 +
 lld/MachO/SectionPriorities.cpp                             | 1 +
 lld/wasm/WriterUtils.h                                      | 1 +
 llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h         | 1 -
 llvm/include/llvm/Support/Atomic.h                          | 2 +-
 llvm/include/llvm/Support/BalancedPartitioning.h            | 3 ++-
 llvm/include/llvm/Support/BinaryStreamReader.h              | 1 -
 llvm/include/llvm/Support/BranchProbability.h               | 1 -
 llvm/include/llvm/Support/CRC.h                             | 2 +-
 llvm/include/llvm/Support/CachePruning.h                    | 4 +++-
 llvm/include/llvm/Support/Casting.h                         | 1 -
 llvm/include/llvm/Support/Chrono.h                          | 5 +----
 llvm/include/llvm/Support/CommandLine.h                     | 4 ----
 llvm/include/llvm/Support/Compression.h                     | 6 ++++--
 llvm/include/llvm/Support/ConvertEBCDIC.h                   | 4 +++-
 llvm/include/llvm/Support/DataExtractor.h                   | 1 -
 llvm/include/llvm/Support/DebugCounter.h                    | 4 ++--
 llvm/include/llvm/Support/ELFAttributeParser.h              | 1 -
 llvm/include/llvm/Support/Error.h                           | 3 ---
 llvm/include/llvm/Support/ErrorHandling.h                   | 2 --
 llvm/include/llvm/Support/ExponentialBackoff.h              | 2 --
 llvm/include/llvm/Support/FileOutputBuffer.h                | 1 -
 llvm/include/llvm/Support/FileUtilities.h                   | 2 --
 llvm/include/llvm/Support/FormatVariadic.h                  | 1 -
 llvm/include/llvm/Support/LineIterator.h                    | 1 -
 llvm/include/llvm/Support/LockFileManager.h                 | 1 -
 llvm/include/llvm/Support/MathExtras.h                      | 1 -
 llvm/include/llvm/Support/Memory.h                          | 1 -
 llvm/include/llvm/Support/OptimizedStructLayout.h           | 3 ++-
 llvm/include/llvm/Support/PGOOptions.h                      | 2 +-
 llvm/include/llvm/Support/Path.h                            | 1 -
 llvm/include/llvm/Support/PrettyStackTrace.h                | 1 -
 llvm/include/llvm/Support/Process.h                         | 1 -
 llvm/include/llvm/Support/RandomNumberGenerator.h           | 2 --
 llvm/include/llvm/Support/ScopedPrinter.h                   | 1 -
 llvm/include/llvm/Support/SpecialCaseList.h                 | 1 -
 llvm/include/llvm/Support/ThreadPool.h                      | 3 +--
 llvm/include/llvm/Support/Threading.h                       | 1 -
 llvm/include/llvm/Support/Timer.h                           | 1 -
 llvm/include/llvm/Support/TypeSize.h                        | 1 -
 llvm/include/llvm/Support/VirtualFileSystem.h               | 1 -
 llvm/include/llvm/Support/Watchdog.h                        | 2 --
 llvm/include/llvm/Support/WithColor.h                       | 1 -
 llvm/include/llvm/Support/raw_ostream.h                     | 2 --
 llvm/include/llvm/Testing/ADT/StringMap.h                   | 1 -
 llvm/lib/Analysis/AliasAnalysis.cpp                         | 1 +
 llvm/lib/Analysis/DXILMetadataAnalysis.cpp                  | 1 +
 llvm/lib/Analysis/DXILResource.cpp                          | 1 +
 llvm/lib/Analysis/InlineAdvisor.cpp                         | 1 +
 llvm/lib/Analysis/InlineOrder.cpp                           | 1 +
 llvm/lib/Analysis/InteractiveModelRunner.cpp                | 1 +
 llvm/lib/Analysis/ReplayInlineAdvisor.cpp                   | 1 +
 llvm/lib/Analysis/StackSafetyAnalysis.cpp                   | 1 +
 llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp               | 1 +
 llvm/lib/CodeGen/MachineCFGPrinter.cpp                      | 2 +-
 llvm/lib/CodeGen/ReplaceWithVeclib.cpp                      | 1 +
 llvm/lib/DebugInfo/BTF/BTFParser.cpp                        | 1 +
 llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp        | 1 +
 llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp                  | 1 +
 llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp              | 1 +
 llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp | 1 +
 .../lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp | 1 +
 .../Orc/TargetProcess/SimpleRemoteEPCServer.cpp             | 1 +
 llvm/lib/FileCheck/FileCheck.cpp                            | 1 +
 llvm/lib/MCA/Stages/InOrderIssueStage.cpp                   | 1 +
 llvm/lib/Object/WasmObjectFile.cpp                          | 1 +
 llvm/lib/Passes/StandardInstrumentations.cpp                | 1 +
 llvm/lib/Support/CachePruning.cpp                           | 1 +
 llvm/lib/Support/ConvertEBCDIC.cpp                          | 1 +
 llvm/lib/Support/CrashRecoveryContext.cpp                   | 1 +
 llvm/lib/Support/DebugCounter.cpp                           | 1 +
 llvm/lib/Support/OptimizedStructLayout.cpp                  | 1 +
 llvm/lib/Support/ThreadPool.cpp                             | 1 +
 llvm/lib/Support/Unix/Process.inc                           | 4 +---
 llvm/lib/Support/Unix/Unix.h                                | 2 +-
 llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp | 1 +
 llvm/lib/Transforms/IPO/GlobalDCE.cpp                       | 1 +
 llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp    | 1 +
 llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp              | 1 +
 llvm/lib/Transforms/Utils/Debugify.cpp                      | 1 +
 llvm/lib/Transforms/Utils/InjectTLIMappings.cpp             | 1 +
 llvm/lib/Transforms/Utils/ModuleUtils.cpp                   | 3 ++-
 llvm/tools/llvm-dwarfdump/SectionSizes.cpp                  | 1 +
 llvm/tools/llvm-dwarfdump/Statistics.cpp                    | 1 +
 llvm/tools/llvm-objdump/MachODump.cpp                       | 1 +
 llvm/tools/llvm-objdump/SourcePrinter.cpp                   | 1 +
 llvm/tools/llvm-objdump/llvm-objdump.cpp                    | 1 +
 llvm/tools/llvm-rc/llvm-rc.cpp                              | 1 +
 llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp              | 1 +
 llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp            | 1 +
 llvm/unittests/Analysis/LazyCallGraphTest.cpp               | 1 +
 llvm/unittests/Support/OptimizedStructLayoutTest.cpp        | 1 +
 llvm/unittests/TargetParser/Host.cpp                        | 1 +
 llvm/unittests/Testing/ADT/StringMapTest.cpp                | 1 +
 102 files changed, 82 insertions(+), 65 deletions(-)

diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
index 3a1f745d9ed777..9fc4d9582824eb 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerWriter.cpp
@@ -30,6 +30,7 @@
 #include "llvm/MC/TargetRegistry.h"
 #include "llvm/Object/COFF.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include <memory>
 #include <utility>
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 97fac41cdd3008..77cc0ef9074a01 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -23,6 +23,7 @@
 #include "UsingDeclarationsSorter.h"
 #include "clang/Tooling/Inclusions/HeaderIncludes.h"
 #include "llvm/ADT/Sequence.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-formatter"
 
diff --git a/clang/lib/Format/FormatTokenSource.h b/clang/lib/Format/FormatTokenSource.h
index 8f00e5f4582c68..246ddd2ec7e581 100644
--- a/clang/lib/Format/FormatTokenSource.h
+++ b/clang/lib/Format/FormatTokenSource.h
@@ -16,6 +16,7 @@
 #define LLVM_CLANG_LIB_FORMAT_FORMATTOKENSOURCE_H
 
 #include "UnwrappedLineParser.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "format-token-source"
 
diff --git a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
index b89a6e2588c987..640dac63b32957 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp
@@ -28,6 +28,7 @@
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/YAMLTraits.h"
 
 #include <limits>
diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp
index 83b5bbb71f5212..101489954d0ad0 100644
--- a/clang/tools/driver/driver.cpp
+++ b/clang/tools/driver/driver.cpp
@@ -35,6 +35,7 @@
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/LLVMDriver.h"
diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp
index b4ee8d0e37efa8..4d67c4abf84ba2 100644
--- a/clang/unittests/Format/MacroCallReconstructorTest.cpp
+++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp
@@ -4,6 +4,7 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Debug.h"
 
 #include "gmock/gmock.h"
 #include "gtest/gtest.h"
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 4c0b4df5bea170..b61d7a5f11647c 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -27,6 +27,7 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/BLAKE3.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/RandomNumberGenerator.h"
 #include "llvm/Support/TimeProfiler.h"
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 568843d72bbb50..5877f6374ce7dc 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -13,6 +13,7 @@
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ProfileData/InstrProfReader.h"
 #include "llvm/Support/BalancedPartitioning.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/xxhash.h"
diff --git a/lld/MachO/Dwarf.cpp b/lld/MachO/Dwarf.cpp
index 47dc51e6196d12..cc817b621570c6 100644
--- a/lld/MachO/Dwarf.cpp
+++ b/lld/MachO/Dwarf.cpp
@@ -10,6 +10,7 @@
 #include "InputFiles.h"
 #include "InputSection.h"
 #include "OutputSegment.h"
+#include "llvm/ADT/StringSwitch.h"
 
 #include <memory>
 
diff --git a/lld/MachO/SectionPriorities.cpp b/lld/MachO/SectionPriorities.cpp
index 69c301d8ff8a71..3d77f7f7dc36f2 100644
--- a/lld/MachO/SectionPriorities.cpp
+++ b/lld/MachO/SectionPriorities.cpp
@@ -23,6 +23,7 @@
 #include "lld/Common/ErrorHandler.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/TimeProfiler.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/lld/wasm/WriterUtils.h b/lld/wasm/WriterUtils.h
index 2be79d1d86e977..0cdca7d978ac56 100644
--- a/lld/wasm/WriterUtils.h
+++ b/lld/wasm/WriterUtils.h
@@ -12,6 +12,7 @@
 #include "lld/Common/LLVM.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Object/Wasm.h"
+#include "llvm/Support/Debug.h"
 
 namespace lld {
 namespace wasm {
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index 4aa922635c374e..06e62b0fc424a9 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -59,7 +59,6 @@ extern llvm::cl::opt<unsigned> IterativeBFIMaxIterationsPerBlock;
 extern llvm::cl::opt<double> IterativeBFIPrecision;
 
 class BranchProbabilityInfo;
-class Function;
 class Loop;
 class LoopInfo;
 class MachineBasicBlock;
diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h
index a8445fddc1a855..44a521dc21f883 100644
--- a/llvm/include/llvm/Support/Atomic.h
+++ b/llvm/include/llvm/Support/Atomic.h
@@ -17,7 +17,7 @@
 #ifndef LLVM_SUPPORT_ATOMIC_H
 #define LLVM_SUPPORT_ATOMIC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 // Windows will at times define MemoryFence.
 #ifdef MemoryFence
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 539d157343fbe3..240ccb268b8341 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -39,7 +39,6 @@
 #ifndef LLVM_SUPPORT_BALANCED_PARTITIONING_H
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
-#include "raw_ostream.h"
 #include "llvm/ADT/ArrayRef.h"
 
 #include <atomic>
@@ -51,6 +50,8 @@
 namespace llvm {
 
 class ThreadPoolInterface;
+class raw_ostream;
+
 /// A function with a set of utility nodes where it is beneficial to order two
 /// functions close together if they have similar utility nodes
 class BPFunctionNode {
diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h
index ca99388c5d03af..43e76fc753358b 100644
--- a/llvm/include/llvm/Support/BinaryStreamReader.h
+++ b/llvm/include/llvm/Support/BinaryStreamReader.h
@@ -11,7 +11,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Alignment.h"
 #include "llvm/Support/BinaryStreamArray.h"
 #include "llvm/Support/BinaryStreamRef.h"
 #include "llvm/Support/ConvertUTF.h"
diff --git a/llvm/include/llvm/Support/BranchProbability.h b/llvm/include/llvm/Support/BranchProbability.h
index 79d70cf611d415..d901ff2a68c6df 100644
--- a/llvm/include/llvm/Support/BranchProbability.h
+++ b/llvm/include/llvm/Support/BranchProbability.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_BRANCHPROBABILITY_H
 #define LLVM_SUPPORT_BRANCHPROBABILITY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
diff --git a/llvm/include/llvm/Support/CRC.h b/llvm/include/llvm/Support/CRC.h
index 210890ae06d47c..a055835d835870 100644
--- a/llvm/include/llvm/Support/CRC.h
+++ b/llvm/include/llvm/Support/CRC.h
@@ -13,7 +13,7 @@
 #ifndef LLVM_SUPPORT_CRC_H
 #define LLVM_SUPPORT_CRC_H
 
-#include "llvm/Support/DataTypes.h"
+#include <stdint.h>
 
 namespace llvm {
 template <typename T> class ArrayRef;
diff --git a/llvm/include/llvm/Support/CachePruning.h b/llvm/include/llvm/Support/CachePruning.h
index 17e148830a73f9..e2d2f2fdd4cf0d 100644
--- a/llvm/include/llvm/Support/CachePruning.h
+++ b/llvm/include/llvm/Support/CachePruning.h
@@ -14,13 +14,15 @@
 #ifndef LLVM_SUPPORT_CACHEPRUNING_H
 #define LLVM_SUPPORT_CACHEPRUNING_H
 
-#include "llvm/Support/MemoryBuffer.h"
 #include <chrono>
+#include <memory>
 #include <optional>
+#include <vector>
 
 namespace llvm {
 
 template <typename T> class Expected;
+class MemoryBuffer;
 class StringRef;
 
 /// Policy for the pruneCache() function. A default constructed
diff --git a/llvm/include/llvm/Support/Casting.h b/llvm/include/llvm/Support/Casting.h
index 14a32ccd0e0dc9..43625961d54335 100644
--- a/llvm/include/llvm/Support/Casting.h
+++ b/llvm/include/llvm/Support/Casting.h
@@ -14,7 +14,6 @@
 #ifndef LLVM_SUPPORT_CASTING_H
 #define LLVM_SUPPORT_CASTING_H
 
-#include "llvm/Support/Compiler.h"
 #include "llvm/Support/type_traits.h"
 #include <cassert>
 #include <memory>
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 71859af7c7e4a5..84e602ab7252fc 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -9,8 +9,7 @@
 #ifndef LLVM_SUPPORT_CHRONO_H
 #define LLVM_SUPPORT_CHRONO_H
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/FormatProviders.h"
+#include "llvm/Support/FormatVariadicDetails.h"
 
 #include <chrono>
 #include <ctime>
@@ -18,8 +17,6 @@
 
 namespace llvm {
 
-class raw_ostream;
-
 namespace sys {
 
 /// A time point on the system clock. This is provided for two reasons:
diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h
index 5d60bb64bbb205..c8d95c7b221267 100644
--- a/llvm/include/llvm/Support/CommandLine.h
+++ b/llvm/include/llvm/Support/CommandLine.h
@@ -20,7 +20,6 @@
 #define LLVM_SUPPORT_COMMANDLINE_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
@@ -31,7 +30,6 @@
 #include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <climits>
 #include <cstddef>
 #include <functional>
 #include <initializer_list>
@@ -45,8 +43,6 @@ namespace vfs {
 class FileSystem;
 }
 
-class StringSaver;
-
 /// This namespace contains all of the command line option processing machinery.
 /// It is intentionally a short name to make qualified usage concise.
 namespace cl {
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index 2a8da9e96d356f..b4294b06e8c679 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -13,10 +13,12 @@
 #ifndef LLVM_SUPPORT_COMPRESSION_H
 #define LLVM_SUPPORT_COMPRESSION_H
 
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <stddef.h>
+#include <stdint.h>
 
 namespace llvm {
+template <typename T> class ArrayRef;
 template <typename T> class SmallVectorImpl;
 class Error;
 
diff --git a/llvm/include/llvm/Support/ConvertEBCDIC.h b/llvm/include/llvm/Support/ConvertEBCDIC.h
index ea761b31e022b7..aa01acc65f7e69 100644
--- a/llvm/include/llvm/Support/ConvertEBCDIC.h
+++ b/llvm/include/llvm/Support/ConvertEBCDIC.h
@@ -13,11 +13,13 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include <system_error>
 
 namespace llvm {
+
+template <typename T> class SmallVectorImpl;
+
 namespace ConverterEBCDIC {
 std::error_code convertToEBCDIC(StringRef Source,
                                 SmallVectorImpl<char> &Result);
diff --git a/llvm/include/llvm/Support/DataExtractor.h b/llvm/include/llvm/Support/DataExtractor.h
index f4f5905d4bccd6..e44576f4700947 100644
--- a/llvm/include/llvm/Support/DataExtractor.h
+++ b/llvm/include/llvm/Support/DataExtractor.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_DATAEXTRACTOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h
index e4345e5739e99d..3321331da3a324 100644
--- a/llvm/include/llvm/Support/DebugCounter.h
+++ b/llvm/include/llvm/Support/DebugCounter.h
@@ -42,16 +42,16 @@
 #ifndef LLVM_SUPPORT_DEBUGCOUNTER_H
 #define LLVM_SUPPORT_DEBUGCOUNTER_H
 
-#include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/UniqueVector.h"
-#include "llvm/Support/Debug.h"
 #include <string>
 
 namespace llvm {
 
 class raw_ostream;
+template <typename T> class ArrayRef;
 
 class DebugCounter {
 public:
diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h
index ffb92468fb37eb..9cd21dfffa5cca 100644
--- a/llvm/include/llvm/Support/ELFAttributeParser.h
+++ b/llvm/include/llvm/Support/ELFAttributeParser.h
@@ -18,7 +18,6 @@
 #include <unordered_map>
 
 namespace llvm {
-class StringRef;
 class ScopedPrinter;
 
 class ELFAttributeParser {
diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index cb06ac19f0bb7d..67ad11969c2ee3 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -17,14 +17,11 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cassert>
-#include <cstdint>
 #include <cstdlib>
 #include <functional>
 #include <memory>
diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h
index 9c8e3448f3a03e..7fd9f63a5cf9c5 100644
--- a/llvm/include/llvm/Support/ErrorHandling.h
+++ b/llvm/include/llvm/Support/ErrorHandling.h
@@ -14,8 +14,6 @@
 #ifndef LLVM_SUPPORT_ERRORHANDLING_H
 #define LLVM_SUPPORT_ERRORHANDLING_H
 
-#include "llvm/Support/Compiler.h"
-
 namespace llvm {
   class StringRef;
   class Twine;
diff --git a/llvm/include/llvm/Support/ExponentialBackoff.h b/llvm/include/llvm/Support/ExponentialBackoff.h
index 8208a748eac2a6..43cc0f2229a97d 100644
--- a/llvm/include/llvm/Support/ExponentialBackoff.h
+++ b/llvm/include/llvm/Support/ExponentialBackoff.h
@@ -12,8 +12,6 @@
 #ifndef LLVM_EXPONENTIALBACKOFF_H
 #define LLVM_EXPONENTIALBACKOFF_H
 
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/Support/Error.h"
 #include <chrono>
 #include <random>
 
diff --git a/llvm/include/llvm/Support/FileOutputBuffer.h b/llvm/include/llvm/Support/FileOutputBuffer.h
index d4b73522115dbf..d7783eaffab5a4 100644
--- a/llvm/include/llvm/Support/FileOutputBuffer.h
+++ b/llvm/include/llvm/Support/FileOutputBuffer.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_FILEOUTPUTBUFFER_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/FileUtilities.h b/llvm/include/llvm/Support/FileUtilities.h
index 9707724d631708..de0f79185bd03f 100644
--- a/llvm/include/llvm/Support/FileUtilities.h
+++ b/llvm/include/llvm/Support/FileUtilities.h
@@ -18,8 +18,6 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
 
-#include <system_error>
-
 namespace llvm {
 
   /// DiffFilesWithTolerance - Compare the two files specified, returning 0 if
diff --git a/llvm/include/llvm/Support/FormatVariadic.h b/llvm/include/llvm/Support/FormatVariadic.h
index 595f2cf559a428..65dbcad430300d 100644
--- a/llvm/include/llvm/Support/FormatVariadic.h
+++ b/llvm/include/llvm/Support/FormatVariadic.h
@@ -26,7 +26,6 @@
 #define LLVM_SUPPORT_FORMATVARIADIC_H
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
diff --git a/llvm/include/llvm/Support/LineIterator.h b/llvm/include/llvm/Support/LineIterator.h
index fc6871baf99a65..16c2d7be2fa453 100644
--- a/llvm/include/llvm/Support/LineIterator.h
+++ b/llvm/include/llvm/Support/LineIterator.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_LINEITERATOR_H
 
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/MemoryBufferRef.h"
 #include <iterator>
 #include <optional>
diff --git a/llvm/include/llvm/Support/LockFileManager.h b/llvm/include/llvm/Support/LockFileManager.h
index 92c7ceed6a929f..f15ee27e58367a 100644
--- a/llvm/include/llvm/Support/LockFileManager.h
+++ b/llvm/include/llvm/Support/LockFileManager.h
@@ -14,7 +14,6 @@
 #include <utility> // for std::pair
 
 namespace llvm {
-class StringRef;
 
 /// Class that manages the creation of a lock file to aid
 /// implicit coordination between different processes.
diff --git a/llvm/include/llvm/Support/MathExtras.h b/llvm/include/llvm/Support/MathExtras.h
index a52a9f07bacd4b..be1e9c4419fc28 100644
--- a/llvm/include/llvm/Support/MathExtras.h
+++ b/llvm/include/llvm/Support/MathExtras.h
@@ -14,7 +14,6 @@
 #define LLVM_SUPPORT_MATHEXTRAS_H
 
 #include "llvm/ADT/bit.h"
-#include "llvm/Support/Compiler.h"
 #include <cassert>
 #include <climits>
 #include <cstdint>
diff --git a/llvm/include/llvm/Support/Memory.h b/llvm/include/llvm/Support/Memory.h
index d7d60371d315f0..bfb13c5bb3ac10 100644
--- a/llvm/include/llvm/Support/Memory.h
+++ b/llvm/include/llvm/Support/Memory.h
@@ -13,7 +13,6 @@
 #ifndef LLVM_SUPPORT_MEMORY_H
 #define LLVM_SUPPORT_MEMORY_H
 
-#include "llvm/Support/DataTypes.h"
 #include <system_error>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/OptimizedStructLayout.h b/llvm/include/llvm/Support/OptimizedStructLayout.h
index 619990d132beba..699cc75cf26d35 100644
--- a/llvm/include/llvm/Support/OptimizedStructLayout.h
+++ b/llvm/include/llvm/Support/OptimizedStructLayout.h
@@ -36,11 +36,12 @@
 #define LLVM_SUPPORT_OPTIMIZEDSTRUCTLAYOUT_H
 
 #include "llvm/Support/Alignment.h"
-#include "llvm/ADT/ArrayRef.h"
 #include <utility>
 
 namespace llvm {
 
+template <typename T> class MutableArrayRef;
+
 /// A field in a structure.
 struct OptimizedStructLayoutField {
   /// A special value for Offset indicating that the field can be moved
diff --git a/llvm/include/llvm/Support/PGOOptions.h b/llvm/include/llvm/Support/PGOOptions.h
index de981abf187058..981b5057ec5f67 100644
--- a/llvm/include/llvm/Support/PGOOptions.h
+++ b/llvm/include/llvm/Support/PGOOptions.h
@@ -15,7 +15,7 @@
 #define LLVM_SUPPORT_PGOOPTIONS_H
 
 #include "llvm/ADT/IntrusiveRefCntPtr.h"
-#include "llvm/Support/Error.h"
+#include <string>
 
 namespace llvm {
 
diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h
index ce69f32b6cc81b..28d9b633213efb 100644
--- a/llvm/include/llvm/Support/Path.h
+++ b/llvm/include/llvm/Support/Path.h
@@ -17,7 +17,6 @@
 
 #include "llvm/ADT/Twine.h"
 #include "llvm/ADT/iterator.h"
-#include "llvm/Support/DataTypes.h"
 #include <iterator>
 
 namespace llvm {
diff --git a/llvm/include/llvm/Support/PrettyStackTrace.h b/llvm/include/llvm/Support/PrettyStackTrace.h
index ac25cffde051c9..602470bc00bece 100644
--- a/llvm/include/llvm/Support/PrettyStackTrace.h
+++ b/llvm/include/llvm/Support/PrettyStackTrace.h
@@ -16,7 +16,6 @@
 #define LLVM_SUPPORT_PRETTYSTACKTRACE_H
 
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Compiler.h"
 
 namespace llvm {
   class raw_ostream;
diff --git a/llvm/include/llvm/Support/Process.h b/llvm/include/llvm/Support/Process.h
index 83f1fcd8b2abca..1b544542acc8fc 100644
--- a/llvm/include/llvm/Support/Process.h
+++ b/llvm/include/llvm/Support/Process.h
@@ -25,7 +25,6 @@
 #define LLVM_SUPPORT_PROCESS_H
 
 #include "llvm/Support/Chrono.h"
-#include "llvm/Support/DataTypes.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/Program.h"
 #include <optional>
diff --git a/llvm/include/llvm/Support/RandomNumberGenerator.h b/llvm/include/llvm/Support/RandomNumberGenerator.h
index 55d6876cc5e41f..de0ce870498e98 100644
--- a/llvm/include/llvm/Support/RandomNumberGenerator.h
+++ b/llvm/include/llvm/Support/RandomNumberGenerator.h
@@ -15,8 +15,6 @@
 #ifndef LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 #define LLVM_SUPPORT_RANDOMNUMBERGENERATOR_H_
 
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h" // Needed for uint64_t on Windows.
 #include <random>
 #include <system_error>
 
diff --git a/llvm/include/llvm/Support/ScopedPrinter.h b/llvm/include/llvm/Support/ScopedPrinter.h
index 419ab97366796e..91e4ad46d27a34 100644
--- a/llvm/include/llvm/Support/ScopedPrinter.h
+++ b/llvm/include/llvm/Support/ScopedPrinter.h
@@ -14,7 +14,6 @@
 #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/JSON.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/llvm/include/llvm/Support/SpecialCaseList.h b/llvm/include/llvm/Support/SpecialCaseList.h
index 6dc1a29c5a281d..2552b4e2983172 100644
--- a/llvm/include/llvm/Support/SpecialCaseList.h
+++ b/llvm/include/llvm/Support/SpecialCaseList.h
@@ -21,7 +21,6 @@
 
 namespace llvm {
 class MemoryBuffer;
-class StringRef;
 
 namespace vfs {
 class FileSystem;
diff --git a/llvm/include/llvm/Support/ThreadPool.h b/llvm/include/llvm/Support/ThreadPool.h
index 014b7a09d7c8ba..1e00167ab18109 100644
--- a/llvm/include/llvm/Support/ThreadPool.h
+++ b/llvm/include/llvm/Support/ThreadPool.h
@@ -17,19 +17,18 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/RWMutex.h"
 #include "llvm/Support/Threading.h"
-#include "llvm/Support/thread.h"
 
 #include <future>
 
 #include <condition_variable>
 #include <deque>
 #include <functional>
-#include <memory>
 #include <mutex>
 #include <utility>
 
 namespace llvm {
 
+class thread;
 class ThreadPoolTaskGroup;
 
 /// This defines the abstract base interface for a ThreadPool allowing
diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h
index ba6c531ab4db21..146f36e216a621 100644
--- a/llvm/include/llvm/Support/Threading.h
+++ b/llvm/include/llvm/Support/Threading.h
@@ -17,7 +17,6 @@
 #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>
 
diff --git a/llvm/include/llvm/Support/Timer.h b/llvm/include/llvm/Support/Timer.h
index 1a32832b6c6536..46a2c00f8a688c 100644
--- a/llvm/include/llvm/Support/Timer.h
+++ b/llvm/include/llvm/Support/Timer.h
@@ -11,7 +11,6 @@
 
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
 #include <cassert>
 #include <memory>
 #include <string>
diff --git a/llvm/include/llvm/Support/TypeSize.h b/llvm/include/llvm/Support/TypeSize.h
index bae833ecca7d49..f91cd2792ec741 100644
--- a/llvm/include/llvm/Support/TypeSize.h
+++ b/llvm/include/llvm/Support/TypeSize.h
@@ -18,7 +18,6 @@
 #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/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h
index f7cfcd4058e722..547ea155f16596 100644
--- a/llvm/include/llvm/Support/VirtualFileSystem.h
+++ b/llvm/include/llvm/Support/VirtualFileSystem.h
@@ -20,7 +20,6 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/Errc.h"
-#include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/ExtensibleRTTI.h"
 #include "llvm/Support/FileSystem.h"
diff --git a/llvm/include/llvm/Support/Watchdog.h b/llvm/include/llvm/Support/Watchdog.h
index 281595e8f27225..b27cda39d09e76 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 e80e5d469363db..1de4ce97712ace 100644
--- a/llvm/include/llvm/Support/WithColor.h
+++ b/llvm/include/llvm/Support/WithColor.h
@@ -15,7 +15,6 @@
 namespace llvm {
 
 class Error;
-class StringRef;
 
 namespace cl {
 class OptionCategory;
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index df9ee2e5a78586..ab315ce1caa7b2 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -15,8 +15,6 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
-#include "llvm/Support/DataTypes.h"
-#include <cassert>
 #include <cstddef>
 #include <cstdint>
 #include <cstring>
diff --git a/llvm/include/llvm/Testing/ADT/StringMap.h b/llvm/include/llvm/Testing/ADT/StringMap.h
index e205b2da8bff4b..2d62077b155fb7 100644
--- a/llvm/include/llvm/Testing/ADT/StringMap.h
+++ b/llvm/include/llvm/Testing/ADT/StringMap.h
@@ -12,7 +12,6 @@
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/Support/FormatVariadic.h"
-#include "llvm/Testing/ADT/StringMapEntry.h"
 #include <ostream>
 #include <sstream>
 
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 6eaaad5f332eb9..22e2bfbd6e5e17 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -47,6 +47,7 @@
 #include "llvm/Support/AtomicOrdering.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include <algorithm>
 #include <cassert>
 #include <functional>
diff --git a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
index 202beeea841c11..34784cb2146c53 100644
--- a/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
+++ b/llvm/lib/Analysis/DXILMetadataAnalysis.cpp
@@ -13,6 +13,7 @@
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Module.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "dxil-metadata-analysis"
 
diff --git a/llvm/lib/Analysis/DXILResource.cpp b/llvm/lib/Analysis/DXILResource.cpp
index 1b5b051c9db29e..f68ba4830539e1 100644
--- a/llvm/lib/Analysis/DXILResource.cpp
+++ b/llvm/lib/Analysis/DXILResource.cpp
@@ -17,6 +17,7 @@
 #include "llvm/IR/Metadata.h"
 #include "llvm/IR/Module.h"
 #include "llvm/InitializePasses.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "dxil-resource"
 
diff --git a/llvm/lib/Analysis/InlineAdvisor.cpp b/llvm/lib/Analysis/InlineAdvisor.cpp
index c6907cb128bb47..1c772c1d413cca 100644
--- a/llvm/lib/Analysis/InlineAdvisor.cpp
+++ b/llvm/lib/Analysis/InlineAdvisor.cpp
@@ -26,6 +26,7 @@
 #include "llvm/IR/Module.h"
 #include "llvm/IR/PassManager.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
 
 using namespace llvm;
diff --git a/llvm/lib/Analysis/InlineOrder.cpp b/llvm/lib/Analysis/InlineOrder.cpp
index f156daa2f126fb..81ca0f61cfeaf9 100644
--- a/llvm/lib/Analysis/InlineOrder.cpp
+++ b/llvm/lib/Analysis/InlineOrder.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Analysis/TargetTransformInfo.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 
 using namespace llvm;
 
diff --git a/llvm/lib/Analysis/InteractiveModelRunner.cpp b/llvm/lib/Analysis/InteractiveModelRunner.cpp
index 99b009b6616fb7..384664445c6870 100644
--- a/llvm/lib/Analysis/InteractiveModelRunner.cpp
+++ b/llvm/lib/Analysis/InteractiveModelRunner.cpp
@@ -12,6 +12,7 @@
 #include "llvm/Analysis/MLModelRunner.h"
 #include "llvm/Analysis/TensorSpec.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/llvm/lib/Analysis/ReplayInlineAdvisor.cpp b/llvm/lib/Analysis/ReplayInlineAdvisor.cpp
index 2ca02eb1741712..c8cc531c5d4cef 100644
--- a/llvm/lib/Analysis/ReplayInlineAdvisor.cpp
+++ b/llvm/lib/Analysis/ReplayInlineAdvisor.cpp
@@ -15,6 +15,7 @@
 
 #include "llvm/Analysis/ReplayInlineAdvisor.h"
 #include "llvm/Analysis/OptimizationRemarkEmitter.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include <memory>
diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
index 27360d0e84cb2b..85627c2975c8ec 100644
--- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp
+++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
@@ -27,6 +27,7 @@
 #include "llvm/InitializePasses.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 #include <algorithm>
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
index 5f66e1ea0a8352..6d3bda133e520f 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriterPass.cpp
@@ -16,6 +16,7 @@
 #include "llvm/IR/PassManager.h"
 #include "llvm/InitializePasses.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Debug.h"
 using namespace llvm;
 
 extern bool WriteNewDbgInfoFormatToBitcode;
diff --git a/llvm/lib/CodeGen/MachineCFGPrinter.cpp b/llvm/lib/CodeGen/MachineCFGPrinter.cpp
index 7bfb8177138089..6999b45ca1f457 100644
--- a/llvm/lib/CodeGen/MachineCFGPrinter.cpp
+++ b/llvm/lib/CodeGen/MachineCFGPrinter.cpp
@@ -1,4 +1,4 @@
-//===- MachineCFGPrinter.cpp - DOT Printer for Machine Functions ----------===//
+//===-   - DOT Printer for Machine Functions ----------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/llvm/lib/CodeGen/ReplaceWithVeclib.cpp b/llvm/lib/CodeGen/ReplaceWithVeclib.cpp
index 9fbb7b461364b1..8fc7cb6e2089aa 100644
--- a/llvm/lib/CodeGen/ReplaceWithVeclib.cpp
+++ b/llvm/lib/CodeGen/ReplaceWithVeclib.cpp
@@ -26,6 +26,7 @@
 #include "llvm/IR/InstIterator.h"
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/VFABIDemangler.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/TypeSize.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 
diff --git a/llvm/lib/DebugInfo/BTF/BTFParser.cpp b/llvm/lib/DebugInfo/BTF/BTFParser.cpp
index 4fc31a44560310..54e18b353918c9 100644
--- a/llvm/lib/DebugInfo/BTF/BTFParser.cpp
+++ b/llvm/lib/DebugInfo/BTF/BTFParser.cpp
@@ -13,6 +13,7 @@
 
 #include "llvm/DebugInfo/BTF/BTFParser.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Errc.h"
 
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
index 1cf73a6667786e..67f4b72afa70c7 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFLocationExpression.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/DebugInfo/DWARF/DWARFLocationExpression.h"
 #include "llvm/ADT/iterator_range.h"
+#include "llvm/Support/FormatProviders.h"
 #include "llvm/Support/FormatVariadic.h"
 
 using namespace llvm;
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
index 77e8ece9439cf9..88b503b6c60d8a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp
@@ -30,6 +30,7 @@
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/FormatProviders.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/JSON.h"
 #include "llvm/Support/WithColor.h"
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp b/llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp
index 6d568199378a02..273d02df78dd6f 100644
--- a/llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/OrcABISupport.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/ExecutionEngine/Orc/OrcABISupport.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Process.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
index 7529d9cef67ed5..109aa0efce4555 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp
@@ -10,6 +10,7 @@
 
 #include "llvm/ExecutionEngine/JITSymbol.h"
 #include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
 
 #include <cstdint>
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp
index f7852b0ca62e53..a7dea82b350805 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderPerf.cpp
@@ -14,6 +14,7 @@
 
 #include "llvm/ExecutionEngine/Orc/Shared/PerfSharedStructs.h"
 
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp
index a585767bf474e6..05c1f0796b50b7 100644
--- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp
@@ -11,6 +11,7 @@
 #include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h"
 #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
 #include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Process.h"
 #include "llvm/TargetParser/Host.h"
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index df5f7f4697c5c4..f39145879fc1e8 100644
--- a/llvm/lib/FileCheck/FileCheck.cpp
+++ b/llvm/lib/FileCheck/FileCheck.cpp
@@ -18,6 +18,7 @@
 #include "llvm/ADT/STLExtras.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"
diff --git a/llvm/lib/MCA/Stages/InOrderIssueStage.cpp b/llvm/lib/MCA/Stages/InOrderIssueStage.cpp
index 30def19b1879a9..e500a9d7c26a14 100644
--- a/llvm/lib/MCA/Stages/InOrderIssueStage.cpp
+++ b/llvm/lib/MCA/Stages/InOrderIssueStage.cpp
@@ -16,6 +16,7 @@
 #include "llvm/MCA/HardwareUnits/RegisterFile.h"
 #include "llvm/MCA/HardwareUnits/RetireControlUnit.h"
 #include "llvm/MCA/Instruction.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "llvm-mca"
 namespace llvm {
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index f244099d664dab..d3a52a864b2ab1 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -18,6 +18,7 @@
 #include "llvm/Object/ObjectFile.h"
 #include "llvm/Object/SymbolicFile.h"
 #include "llvm/Object/Wasm.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
diff --git a/llvm/lib/Passes/StandardInstrumentations.cpp b/llvm/lib/Passes/StandardInstrumentations.cpp
index 036484c9c1c0c4..3ec0489c555241 100644
--- a/llvm/lib/Passes/StandardInstrumentations.cpp
+++ b/llvm/lib/Passes/StandardInstrumentations.cpp
@@ -37,6 +37,7 @@
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/GraphWriter.h"
 #include "llvm/Support/MemoryBuffer.h"
+#include "llvm/Support/NativeFormatting.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
 #include "llvm/Support/Regex.h"
diff --git a/llvm/lib/Support/CachePruning.cpp b/llvm/lib/Support/CachePruning.cpp
index 4eae08b18c9b53..51d4d661198e79 100644
--- a/llvm/lib/Support/CachePruning.cpp
+++ b/llvm/lib/Support/CachePruning.cpp
@@ -16,6 +16,7 @@
 #include "llvm/Support/Errc.h"
 #include "llvm/Support/Error.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"
diff --git a/llvm/lib/Support/ConvertEBCDIC.cpp b/llvm/lib/Support/ConvertEBCDIC.cpp
index 08eeaa52a6c97f..d1aa0bea75258c 100644
--- a/llvm/lib/Support/ConvertEBCDIC.cpp
+++ b/llvm/lib/Support/ConvertEBCDIC.cpp
@@ -14,6 +14,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/ConvertEBCDIC.h"
+#include "llvm/ADT/SmallVector.h"
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index f53aea177d6127..5b72341daab0d5 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -8,6 +8,7 @@
 
 #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"
diff --git a/llvm/lib/Support/DebugCounter.cpp b/llvm/lib/Support/DebugCounter.cpp
index a5d8a704bdd213..9460ab0d7af183 100644
--- a/llvm/lib/Support/DebugCounter.cpp
+++ b/llvm/lib/Support/DebugCounter.cpp
@@ -3,6 +3,7 @@
 #include "DebugOptions.h"
 
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/Format.h"
 
 using namespace llvm;
diff --git a/llvm/lib/Support/OptimizedStructLayout.cpp b/llvm/lib/Support/OptimizedStructLayout.cpp
index 7b21f927a3462c..c8236488388b80 100644
--- a/llvm/lib/Support/OptimizedStructLayout.cpp
+++ b/llvm/lib/Support/OptimizedStructLayout.cpp
@@ -11,6 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/OptimizedStructLayout.h"
+#include "llvm/ADT/ArrayRef.h"
 #include <optional>
 
 using namespace llvm;
diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp
index 27e0f220ac4ed6..c132f92d258e61 100644
--- a/llvm/lib/Support/ThreadPool.cpp
+++ b/llvm/lib/Support/ThreadPool.cpp
@@ -17,6 +17,7 @@
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/thread.h"
 
 using namespace llvm;
 
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index 84b10ff5d1d08a..498c028581cdfe 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -12,10 +12,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>
 #endif
diff --git a/llvm/lib/Support/Unix/Unix.h b/llvm/lib/Support/Unix/Unix.h
index 1599241a344af8..40d8814e0762c4 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/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp
index 04b4c7d78aabb3..fcaba9990b6025 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp
@@ -19,6 +19,7 @@
 #include "llvm/IR/InstVisitor.h"
 #include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
+#include "llvm/Support/Debug.h"
 using namespace llvm;
 
 #define DEBUG_TYPE "wasm-ref-type-mem2local"
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index e36d524d7667ab..1ecf25774ffa76 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -22,6 +22,7 @@
 #include "llvm/IR/IntrinsicInst.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Utils/CtorUtils.h"
 #include "llvm/Transforms/Utils/GlobalStatus.h"
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index 66b68d5cd457fb..2b2d043060c4e4 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -39,6 +39,7 @@
 #include "llvm/IR/ModuleSummaryIndex.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/GraphWriter.h"
 #include "llvm/Support/raw_ostream.h"
diff --git a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
index a25632acbfcc3a..4fc3444dd6f6e6 100644
--- a/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
+++ b/llvm/lib/Transforms/Utils/AMDGPUEmitPrintf.cpp
@@ -20,6 +20,7 @@
 #include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Support/DataExtractor.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/MathExtras.h"
 
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index fcc82eadac36cf..c885de3f8d40cf 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -25,6 +25,7 @@
 #include "llvm/IR/PassInstrumentation.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/JSON.h"
 #include <optional>
diff --git a/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp b/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
index 9bfac2ac9167ef..f6797ac589a101 100644
--- a/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
+++ b/llvm/lib/Transforms/Utils/InjectTLIMappings.cpp
@@ -20,6 +20,7 @@
 #include "llvm/Analysis/VectorUtils.h"
 #include "llvm/IR/InstIterator.h"
 #include "llvm/IR/VFABIDemangler.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Transforms/Utils/ModuleUtils.h"
 
 using namespace llvm;
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index 309cf8e70b979c..ee8a9825ca1ebb 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -11,13 +11,14 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Utils/ModuleUtils.h"
-#include "llvm/Analysis/VectorUtils.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/Analysis/VectorUtils.h"
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/MDBuilder.h"
 #include "llvm/IR/Module.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Support/xxhash.h"
diff --git a/llvm/tools/llvm-dwarfdump/SectionSizes.cpp b/llvm/tools/llvm-dwarfdump/SectionSizes.cpp
index 731bf05fd75870..02ddb83c5c3e55 100644
--- a/llvm/tools/llvm-dwarfdump/SectionSizes.cpp
+++ b/llvm/tools/llvm-dwarfdump/SectionSizes.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm-dwarfdump.h"
+#include "llvm/Support/Debug.h"
 
 #define DEBUG_TYPE "dwarfdump"
 
diff --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index 8d6dd17ceae904..fbff7d3eacc77a 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -14,6 +14,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
 #include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/Object/ObjectFile.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/JSON.h"
 
 #define DEBUG_TYPE "dwarfdump"
diff --git a/llvm/tools/llvm-objdump/MachODump.cpp b/llvm/tools/llvm-objdump/MachODump.cpp
index 0544fc4f406bb0..4fceb6042fd224 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-objdump/SourcePrinter.cpp b/llvm/tools/llvm-objdump/SourcePrinter.cpp
index 76da86587586ee..82498888209cbc 100644
--- a/llvm/tools/llvm-objdump/SourcePrinter.cpp
+++ b/llvm/tools/llvm-objdump/SourcePrinter.cpp
@@ -19,6 +19,7 @@
 #include "llvm/DebugInfo/DWARF/DWARFExpression.h"
 #include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
 #include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/FormatVariadic.h"
 
 #define DEBUG_TYPE "objdump"
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index b69d14b4e7609a..9865aaca2e3212 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -28,6 +28,7 @@
 #include "llvm/ADT/SetOperations.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/BinaryFormat/Wasm.h"
 #include "llvm/DebugInfo/BTF/BTFParser.h"
diff --git a/llvm/tools/llvm-rc/llvm-rc.cpp b/llvm/tools/llvm-rc/llvm-rc.cpp
index 51214524adeef6..fdb6a2156111a7 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-symbolizer/llvm-symbolizer.cpp b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
index 3e41a85d646956..331d5a4a4c1447 100644
--- a/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
+++ b/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
@@ -17,6 +17,7 @@
 #include "Opts.inc"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Config/config.h"
 #include "llvm/DebugInfo/Symbolize/DIPrinter.h"
 #include "llvm/DebugInfo/Symbolize/Markup.h"
diff --git a/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp b/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
index a091e37ff4026d..cfd881aa194351 100644
--- a/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
+++ b/llvm/tools/llvm-tli-checker/llvm-tli-checker.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/StringSwitch.h"
 #include "llvm/Analysis/TargetLibraryInfo.h"
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Demangle/Demangle.h"
diff --git a/llvm/unittests/Analysis/LazyCallGraphTest.cpp b/llvm/unittests/Analysis/LazyCallGraphTest.cpp
index 6cfc01ed81102f..bfeeb0b170ef28 100644
--- a/llvm/unittests/Analysis/LazyCallGraphTest.cpp
+++ b/llvm/unittests/Analysis/LazyCallGraphTest.cpp
@@ -13,6 +13,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Verifier.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/SourceMgr.h"
 #include "llvm/TargetParser/Triple.h"
diff --git a/llvm/unittests/Support/OptimizedStructLayoutTest.cpp b/llvm/unittests/Support/OptimizedStructLayoutTest.cpp
index e8cd5f4285e526..fc0aca8f66d8d1 100644
--- a/llvm/unittests/Support/OptimizedStructLayoutTest.cpp
+++ b/llvm/unittests/Support/OptimizedStructLayoutTest.cpp
@@ -7,6 +7,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/OptimizedStructLayout.h"
+#include "llvm/ADT/ArrayRef.h"
 #include "gtest/gtest.h"
 
 using namespace llvm;
diff --git a/llvm/unittests/TargetParser/Host.cpp b/llvm/unittests/TargetParser/Host.cpp
index f8dd1d3a60a005..3ec12bbf64d6b7 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/unittests/Testing/ADT/StringMapTest.cpp b/llvm/unittests/Testing/ADT/StringMapTest.cpp
index 06bbaee72e5166..d5170fe663ee0b 100644
--- a/llvm/unittests/Testing/ADT/StringMapTest.cpp
+++ b/llvm/unittests/Testing/ADT/StringMapTest.cpp
@@ -8,6 +8,7 @@
 
 #include "llvm/Testing/ADT/StringMap.h"
 #include "llvm/ADT/StringMap.h"
+#include "llvm/Testing/ADT/StringMapEntry.h"
 
 #include "gtest/gtest.h"
 #include <sstream>

>From e9a313fd31f0fd75c54afd6a42106908507a0ee9 Mon Sep 17 00:00:00 2001
From: dfukalov <dfukalov at gmail.com>
Date: Mon, 19 Aug 2024 20:58:31 +0200
Subject: [PATCH 2/4] fixup! [NFC] Cleanup in Support headers.

Fixed windows build.
---
 llvm/include/llvm/Support/Error.h       | 1 +
 llvm/include/llvm/Support/raw_ostream.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/llvm/include/llvm/Support/Error.h b/llvm/include/llvm/Support/Error.h
index 67ad11969c2ee3..786f3bf5b281e0 100644
--- a/llvm/include/llvm/Support/Error.h
+++ b/llvm/include/llvm/Support/Error.h
@@ -17,6 +17,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/abi-breaking.h"
 #include "llvm/Support/AlignOf.h"
+#include "llvm/Support/Debug.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ErrorOr.h"
 #include "llvm/Support/Format.h"
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index ab315ce1caa7b2..d048fdb86a58e3 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -15,6 +15,7 @@
 
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/DataTypes.h"
 #include <cstddef>
 #include <cstdint>
 #include <cstring>

>From b242073e1c59a10c0f9e5647c5b37204eee3a83e Mon Sep 17 00:00:00 2001
From: dfukalov <dfukalov at gmail.com>
Date: Tue, 20 Aug 2024 02:03:30 +0200
Subject: [PATCH 3/4] fixup! fixup! [NFC] Cleanup in Support headers.

Fixed bolt build.
---
 bolt/tools/merge-fdata/merge-fdata.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp
index f2ac5ad4492ee5..6d68b0535ac8bc 100644
--- a/bolt/tools/merge-fdata/merge-fdata.cpp
+++ b/bolt/tools/merge-fdata/merge-fdata.cpp
@@ -21,6 +21,7 @@
 #include "llvm/Support/PrettyStackTrace.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/ThreadPool.h"
+#include "llvm/Support/thread.h"
 #include <algorithm>
 #include <mutex>
 #include <unordered_map>

>From 892b7e32a49d02f6bf41966636cafaf7fc970618 Mon Sep 17 00:00:00 2001
From: Daniil Fukalov <dfukalov at gmail.com>
Date: Tue, 20 Aug 2024 12:01:29 +0200
Subject: [PATCH 4/4] fixup! [NFC] Cleanup in Support headers. Addressed
 comments.

---
 lld/MachO/Dwarf.cpp                                         | 1 -
 llvm/include/llvm/Support/BalancedPartitioning.h            | 1 -
 llvm/include/llvm/Support/Chrono.h                          | 1 -
 llvm/include/llvm/Support/Compression.h                     | 4 ++--
 llvm/lib/CodeGen/MachineCFGPrinter.cpp                      | 2 +-
 llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp | 1 +
 6 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/lld/MachO/Dwarf.cpp b/lld/MachO/Dwarf.cpp
index cc817b621570c6..4d7a81a5f4f18e 100644
--- a/lld/MachO/Dwarf.cpp
+++ b/lld/MachO/Dwarf.cpp
@@ -11,7 +11,6 @@
 #include "InputSection.h"
 #include "OutputSegment.h"
 #include "llvm/ADT/StringSwitch.h"
-
 #include <memory>
 
 using namespace lld;
diff --git a/llvm/include/llvm/Support/BalancedPartitioning.h b/llvm/include/llvm/Support/BalancedPartitioning.h
index 240ccb268b8341..ef63e1567e6945 100644
--- a/llvm/include/llvm/Support/BalancedPartitioning.h
+++ b/llvm/include/llvm/Support/BalancedPartitioning.h
@@ -40,7 +40,6 @@
 #define LLVM_SUPPORT_BALANCED_PARTITIONING_H
 
 #include "llvm/ADT/ArrayRef.h"
-
 #include <atomic>
 #include <condition_variable>
 #include <mutex>
diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h
index 84e602ab7252fc..ac7a5444c2a462 100644
--- a/llvm/include/llvm/Support/Chrono.h
+++ b/llvm/include/llvm/Support/Chrono.h
@@ -10,7 +10,6 @@
 #define LLVM_SUPPORT_CHRONO_H
 
 #include "llvm/Support/FormatVariadicDetails.h"
-
 #include <chrono>
 #include <ctime>
 #include <ratio>
diff --git a/llvm/include/llvm/Support/Compression.h b/llvm/include/llvm/Support/Compression.h
index b4294b06e8c679..967d07fa554f46 100644
--- a/llvm/include/llvm/Support/Compression.h
+++ b/llvm/include/llvm/Support/Compression.h
@@ -14,8 +14,8 @@
 #define LLVM_SUPPORT_COMPRESSION_H
 
 #include "llvm/Support/ErrorHandling.h"
-#include <stddef.h>
-#include <stdint.h>
+#include <cstddef>
+#include <cstdint>
 
 namespace llvm {
 template <typename T> class ArrayRef;
diff --git a/llvm/lib/CodeGen/MachineCFGPrinter.cpp b/llvm/lib/CodeGen/MachineCFGPrinter.cpp
index 6999b45ca1f457..7bfb8177138089 100644
--- a/llvm/lib/CodeGen/MachineCFGPrinter.cpp
+++ b/llvm/lib/CodeGen/MachineCFGPrinter.cpp
@@ -1,4 +1,4 @@
-//===-   - DOT Printer for Machine Functions ----------===//
+//===- MachineCFGPrinter.cpp - DOT Printer for Machine Functions ----------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp
index fcaba9990b6025..ad16c1f0280a31 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRefTypeMem2Local.cpp
@@ -20,6 +20,7 @@
 #include "llvm/IR/ValueHandle.h"
 #include "llvm/Pass.h"
 #include "llvm/Support/Debug.h"
+
 using namespace llvm;
 
 #define DEBUG_TYPE "wasm-ref-type-mem2local"



More information about the cfe-commits mailing list