[all-commits] [llvm/llvm-project] 75e164: [llvm] Cleanup header dependencies in ADT and Support

serge-sans-paille via All-commits all-commits at lists.llvm.org
Fri Jan 21 04:55:20 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 75e164f61d391979b4829bf2746a5d74b94e95f2
      https://github.com/llvm/llvm-project/commit/75e164f61d391979b4829bf2746a5d74b94e95f2
  Author: serge-sans-paille <sguelton at redhat.com>
  Date:   2022-01-21 (Fri, 21 Jan 2022)

  Changed paths:
    M clang/lib/Basic/Targets/AArch64.h
    M clang/lib/Basic/Targets/ARM.h
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/lib/Driver/ToolChains/Arch/AArch64.cpp
    M clang/lib/Driver/ToolChains/Arch/ARM.cpp
    M clang/lib/Driver/ToolChains/Arch/ARM.h
    M clang/tools/libclang/BuildSystem.cpp
    M lldb/source/Host/common/Socket.cpp
    M llvm/include/llvm/ADT/Optional.h
    M llvm/include/llvm/ADT/SmallVector.h
    M llvm/include/llvm/MC/MCStreamer.h
    M llvm/include/llvm/Object/ELFObjectFile.h
    M llvm/include/llvm/Support/AArch64TargetParser.h
    M llvm/include/llvm/Support/ARMAttributeParser.h
    M llvm/include/llvm/Support/Allocator.h
    M llvm/include/llvm/Support/BinaryStreamReader.h
    M llvm/include/llvm/Support/BinaryStreamRef.h
    M llvm/include/llvm/Support/BinaryStreamWriter.h
    M llvm/include/llvm/Support/BlockFrequency.h
    M llvm/include/llvm/Support/BranchProbability.h
    M llvm/include/llvm/Support/ConvertUTF.h
    M llvm/include/llvm/Support/ELFAttributeParser.h
    M llvm/include/llvm/Support/Error.h
    M llvm/include/llvm/Support/ExtensibleRTTI.h
    M llvm/include/llvm/Support/FileCollector.h
    M llvm/include/llvm/Support/FileUtilities.h
    M llvm/include/llvm/Support/FormatVariadic.h
    M llvm/include/llvm/Support/GraphWriter.h
    M llvm/include/llvm/Support/ItaniumManglingCanonicalizer.h
    M llvm/include/llvm/Support/RISCVISAInfo.h
    M llvm/include/llvm/Support/SymbolRemappingReader.h
    M llvm/include/llvm/Support/TargetParser.h
    M llvm/include/llvm/Support/TimeProfiler.h
    M llvm/include/llvm/Support/Timer.h
    M llvm/include/llvm/Support/TrigramIndex.h
    M llvm/include/llvm/Support/TypeSize.h
    M llvm/include/llvm/Support/YAMLTraits.h
    M llvm/lib/Debuginfod/Debuginfod.cpp
    M llvm/lib/Object/Object.cpp
    M llvm/lib/Support/APInt.cpp
    M llvm/lib/Support/ARMAttributeParser.cpp
    M llvm/lib/Support/ARMWinEH.cpp
    M llvm/lib/Support/BlockFrequency.cpp
    M llvm/lib/Support/DAGDeltaAlgorithm.cpp
    M llvm/lib/Support/DataExtractor.cpp
    M llvm/lib/Support/ELFAttributeParser.cpp
    M llvm/lib/Support/FileOutputBuffer.cpp
    M llvm/lib/Support/FileUtilities.cpp
    M llvm/lib/Support/GraphWriter.cpp
    M llvm/lib/Support/InitLLVM.cpp
    M llvm/lib/Support/JSON.cpp
    M llvm/lib/Support/MSP430AttributeParser.cpp
    M llvm/lib/Support/MemoryBuffer.cpp
    M llvm/lib/Support/NativeFormatting.cpp
    M llvm/lib/Support/PrettyStackTrace.cpp
    M llvm/lib/Support/ScopedPrinter.cpp
    M llvm/lib/Support/Signals.cpp
    M llvm/lib/Support/Signposts.cpp
    M llvm/lib/Support/SmallPtrSet.cpp
    M llvm/lib/Support/SmallVector.cpp
    M llvm/lib/Support/SpecialCaseList.cpp
    M llvm/lib/Support/StringMap.cpp
    M llvm/lib/Support/SymbolRemappingReader.cpp
    M llvm/lib/Support/TargetParser.cpp
    M llvm/lib/Support/ThreadPool.cpp
    M llvm/lib/Support/TimeProfiler.cpp
    M llvm/lib/Support/ToolOutputFile.cpp
    M llvm/lib/Support/Triple.cpp
    M llvm/lib/Support/TypeSize.cpp
    M llvm/lib/Support/VirtualFileSystem.cpp
    M llvm/lib/Support/X86TargetParser.cpp
    M llvm/lib/Support/YAMLParser.cpp
    M llvm/lib/Support/YAMLTraits.cpp
    M llvm/lib/Support/raw_ostream.cpp
    M llvm/lib/Target/AArch64/AArch64Subtarget.cpp
    M llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
    M llvm/lib/Target/ARM/ARMSubtarget.cpp
    M llvm/lib/Target/ARM/ARMTargetMachine.cpp
    M llvm/tools/llvm-diff/llvm-diff.cpp
    M llvm/tools/llvm-lto/llvm-lto.cpp
    M llvm/tools/llvm-modextract/llvm-modextract.cpp
    M llvm/tools/llvm-reduce/llvm-reduce.cpp
    M llvm/tools/llvm-split/llvm-split.cpp
    M llvm/tools/llvm-stress/llvm-stress.cpp
    M llvm/unittests/Support/TargetParserTest.cpp
    M llvm/unittests/Support/raw_ostream_test.cpp
    M mlir/lib/TableGen/Format.cpp
    M mlir/lib/TableGen/Predicate.cpp
    M mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp
    M mlir/tools/mlir-tblgen/OpFormatGen.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list