From b48e3782182639d4e59624290f166a84e53300bb Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Wed, 26 Jan 2022 08:02:49 -0500 Subject: [PATCH] Cleanup LLVMTextAPI headers Based on the output of iwyu. A full rebuild of llvm-project doesn't exhibit any significant false dependencies. The impact on preprocessed output is larger than expected, given the small amount of changes $ clang++ -E -Iinclude -I../llvm/include ../llvm/lib/TextAPI/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l before: 635319 After: 643716 Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup --- llvm/include/llvm/TextAPI/InterfaceFile.h | 4 ---- llvm/include/llvm/TextAPI/Target.h | 4 +++- llvm/lib/TextAPI/Architecture.cpp | 2 +- llvm/lib/TextAPI/PackedVersion.cpp | 1 - llvm/lib/TextAPI/Target.cpp | 5 +---- llvm/lib/TextAPI/TextStubCommon.h | 9 +++++++-- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/llvm/include/llvm/TextAPI/InterfaceFile.h b/llvm/include/llvm/TextAPI/InterfaceFile.h index 6ef4db2..5f07397 100644 --- a/llvm/include/llvm/TextAPI/InterfaceFile.h +++ b/llvm/include/llvm/TextAPI/InterfaceFile.h @@ -19,11 +19,7 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/iterator.h" -#include "llvm/BinaryFormat/MachO.h" -#include "llvm/BinaryFormat/Magic.h" #include "llvm/Support/Allocator.h" -#include "llvm/Support/Error.h" -#include "llvm/TextAPI/Architecture.h" #include "llvm/TextAPI/ArchitectureSet.h" #include "llvm/TextAPI/PackedVersion.h" #include "llvm/TextAPI/Platform.h" diff --git a/llvm/include/llvm/TextAPI/Target.h b/llvm/include/llvm/TextAPI/Target.h index e35afcc..fbb7629 100644 --- a/llvm/include/llvm/TextAPI/Target.h +++ b/llvm/include/llvm/TextAPI/Target.h @@ -9,13 +9,15 @@ #ifndef LLVM_TEXTAPI_TARGET_H #define LLVM_TEXTAPI_TARGET_H -#include "llvm/ADT/Triple.h" #include "llvm/Support/Error.h" #include "llvm/TextAPI/Architecture.h" #include "llvm/TextAPI/ArchitectureSet.h" #include "llvm/TextAPI/Platform.h" namespace llvm { + +class Triple; + namespace MachO { // This is similar to a llvm Triple, but the triple doesn't have all the diff --git a/llvm/lib/TextAPI/Architecture.cpp b/llvm/lib/TextAPI/Architecture.cpp index e1901d5..bb349b2 100644 --- a/llvm/lib/TextAPI/Architecture.cpp +++ b/llvm/lib/TextAPI/Architecture.cpp @@ -15,7 +15,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/BinaryFormat/MachO.h" #include "llvm/Support/raw_ostream.h" -#include "llvm/TextAPI/ArchitectureSet.h" +#include "llvm/Support/ErrorHandling.h" namespace llvm { namespace MachO { diff --git a/llvm/lib/TextAPI/PackedVersion.cpp b/llvm/lib/TextAPI/PackedVersion.cpp index f8171e0..67fb30a 100644 --- a/llvm/lib/TextAPI/PackedVersion.cpp +++ b/llvm/lib/TextAPI/PackedVersion.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "llvm/TextAPI/PackedVersion.h" -#include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Format.h" diff --git a/llvm/lib/TextAPI/Target.cpp b/llvm/lib/TextAPI/Target.cpp index feeb5c6..c54c3bd 100644 --- a/llvm/lib/TextAPI/Target.cpp +++ b/llvm/lib/TextAPI/Target.cpp @@ -7,11 +7,8 @@ //===----------------------------------------------------------------------===// #include "llvm/TextAPI/Target.h" -#include "llvm/ADT/SmallString.h" -#include "llvm/ADT/SmallVector.h" -#include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/Support/Format.h" +#include "llvm/ADT/Twine.h" #include "llvm/Support/raw_ostream.h" namespace llvm { diff --git a/llvm/lib/TextAPI/TextStubCommon.h b/llvm/lib/TextAPI/TextStubCommon.h index 89ae5d5..aac2722 100644 --- a/llvm/lib/TextAPI/TextStubCommon.h +++ b/llvm/lib/TextAPI/TextStubCommon.h @@ -16,9 +16,9 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/YAMLTraits.h" #include "llvm/TextAPI/Architecture.h" -#include "llvm/TextAPI/ArchitectureSet.h" #include "llvm/TextAPI/InterfaceFile.h" -#include "llvm/TextAPI/PackedVersion.h" +#include "llvm/TextAPI/Platform.h" +#include "llvm/TextAPI/Target.h" using UUID = std::pair; @@ -28,6 +28,11 @@ LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(UUID) LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(FlowStringRef) namespace llvm { + +namespace MachO { + class ArchitectureSet; + class PackedVersion; +} namespace yaml { template <> struct ScalarTraits { -- 2.7.4