Skip to content

Commit 75e164f

Browse files
author
serge-sans-paille
committed
[llvm] Cleanup header dependencies in ADT and Support
The cleanup was manual, but assisted by "include-what-you-use". It consists in 1. Removing unused forward declaration. No impact expected. 2. Removing unused headers in .cpp files. No impact expected. 3. Removing unused headers in .h files. This removes implicit dependencies and is generally considered a good thing, but this may break downstream builds. I've updated llvm, clang, lld, lldb and mlir deps, and included a list of the modification in the second part of the commit. 4. Replacing header inclusion by forward declaration. This has the same impact as 3. Notable changes: - llvm/Support/TargetParser.h no longer includes llvm/Support/AArch64TargetParser.h nor llvm/Support/ARMTargetParser.h - llvm/Support/TypeSize.h no longer includes llvm/Support/WithColor.h - llvm/Support/YAMLTraits.h no longer includes llvm/Support/Regex.h - llvm/ADT/SmallVector.h no longer includes llvm/Support/MemAlloc.h nor llvm/Support/ErrorHandling.h You may need to add some of these headers in your compilation units, if needs be. As an hint to the impact of the cleanup, running clang++ -E -Iinclude -I../llvm/include ../llvm/lib/Support/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 8000919 lines after: 7917500 lines Reduced dependencies also helps incremental rebuilds and is more ccache friendly, something not shown by the above metric :-) Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup/5831
1 parent 0abaf64 commit 75e164f

File tree

90 files changed

+63
-93
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+63
-93
lines changed

clang/lib/Basic/Targets/AArch64.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "OSTargets.h"
1717
#include "clang/Basic/TargetBuiltins.h"
18+
#include "llvm/Support/AArch64TargetParser.h"
1819
#include "llvm/Support/TargetParser.h"
1920

2021
namespace clang {

clang/lib/Basic/Targets/ARM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "clang/Basic/TargetOptions.h"
1919
#include "llvm/ADT/Triple.h"
2020
#include "llvm/Support/Compiler.h"
21+
#include "llvm/Support/ARMTargetParser.h"
2122
#include "llvm/Support/TargetParser.h"
2223

2324
namespace clang {

clang/lib/Driver/SanitizerArgs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/ADT/StringSwitch.h"
1717
#include "llvm/Support/Path.h"
1818
#include "llvm/Support/SpecialCaseList.h"
19+
#include "llvm/Support/AArch64TargetParser.h"
1920
#include "llvm/Support/TargetParser.h"
2021
#include "llvm/Support/VirtualFileSystem.h"
2122
#include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"

clang/lib/Driver/ToolChains/Arch/AArch64.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "clang/Driver/DriverDiagnostic.h"
1212
#include "clang/Driver/Options.h"
1313
#include "llvm/Option/ArgList.h"
14+
#include "llvm/Support/AArch64TargetParser.h"
1415
#include "llvm/Support/TargetParser.h"
1516
#include "llvm/Support/Host.h"
1617

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "clang/Driver/Options.h"
1313
#include "llvm/ADT/StringSwitch.h"
1414
#include "llvm/Option/ArgList.h"
15+
#include "llvm/Support/ARMTargetParser.h"
1516
#include "llvm/Support/TargetParser.h"
1617
#include "llvm/Support/Host.h"
1718

clang/lib/Driver/ToolChains/Arch/ARM.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/ADT/StringRef.h"
1414
#include "llvm/ADT/Triple.h"
1515
#include "llvm/Option/Option.h"
16+
#include "llvm/Support/ARMTargetParser.h"
1617
#include "llvm/Support/TargetParser.h"
1718
#include <string>
1819
#include <vector>

clang/tools/libclang/BuildSystem.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "llvm/Support/CBindingWrapping.h"
1717
#include "llvm/Support/Chrono.h"
1818
#include "llvm/Support/ErrorHandling.h"
19+
#include "llvm/Support/MemAlloc.h"
1920
#include "llvm/Support/Path.h"
2021
#include "llvm/Support/VirtualFileSystem.h"
2122
#include "llvm/Support/raw_ostream.h"

lldb/source/Host/common/Socket.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/ADT/STLExtras.h"
1919
#include "llvm/Support/Errno.h"
2020
#include "llvm/Support/Error.h"
21+
#include "llvm/Support/Regex.h"
2122
#include "llvm/Support/WindowsError.h"
2223

2324
#if LLDB_ENABLE_POSIX

llvm/include/llvm/ADT/Optional.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "llvm/Support/Compiler.h"
2222
#include "llvm/Support/type_traits.h"
2323
#include <cassert>
24-
#include <memory>
2524
#include <new>
2625
#include <utility>
2726

llvm/include/llvm/ADT/SmallVector.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515

1616
#include "llvm/ADT/iterator_range.h"
1717
#include "llvm/Support/Compiler.h"
18-
#include "llvm/Support/ErrorHandling.h"
19-
#include "llvm/Support/MemAlloc.h"
2018
#include "llvm/Support/type_traits.h"
2119
#include <algorithm>
2220
#include <cassert>

0 commit comments

Comments
 (0)