Cleanup header dependencies in LLVMCore
authorserge-sans-paille <sguelton@redhat.com>
Mon, 31 Jan 2022 21:35:07 +0000 (22:35 +0100)
committerserge-sans-paille <sguelton@redhat.com>
Wed, 2 Feb 2022 05:54:20 +0000 (06:54 +0100)
commite188aae406f3fecaed65a1f7e6562205f0de937e
tree63bb878f1af0f30be1540c4f2af9e9bf54d74061
parent5a5037c602dcd90d983553e4f7d5429a06a8e6f9
Cleanup header dependencies in LLVMCore

Based on the output of include-what-you-use.

This is a big chunk of changes. It is very likely to break downstream code
unless they took a lot of care in avoiding hidden ehader dependencies, something
the LLVM codebase doesn't do that well :-/

I've tried to summarize the biggest change below:

- llvm/include/llvm-c/Core.h: no longer includes llvm-c/ErrorHandling.h
- llvm/IR/DIBuilder.h no longer includes llvm/IR/DebugInfo.h
- llvm/IR/IRBuilder.h no longer includes llvm/IR/IntrinsicInst.h
- llvm/IR/LLVMRemarkStreamer.h no longer includes llvm/Support/ToolOutputFile.h
- llvm/IR/LegacyPassManager.h no longer include llvm/Pass.h
- llvm/IR/Type.h no longer includes llvm/ADT/SmallPtrSet.h
- llvm/IR/PassManager.h no longer includes llvm/Pass.h nor llvm/Support/Debug.h

And the usual count of preprocessed lines:
$ clang++ -E  -Iinclude -I../llvm/include ../llvm/lib/IR/*.cpp -std=c++14 -fno-rtti -fno-exceptions | wc -l
before: 6400831
after:  6189948

200k lines less to process is no that bad ;-)

Discourse thread on the topic: https://llvm.discourse.group/t/include-what-you-use-include-cleanup

Differential Revision: https://reviews.llvm.org/D118652
118 files changed:
clang/lib/CodeGen/CGStmtOpenMP.cpp
llvm/examples/IRTransforms/InitializePasses.h
llvm/include/llvm-c/Core.h
llvm/include/llvm-c/DebugInfo.h
llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
llvm/include/llvm/Analysis/CycleAnalysis.h
llvm/include/llvm/Analysis/MLInlineAdvisor.h
llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h
llvm/include/llvm/Analysis/SparsePropagation.h
llvm/include/llvm/CodeGen/ReplaceWithVeclib.h
llvm/include/llvm/IR/AbstractCallSite.h
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/IR/CFG.h
llvm/include/llvm/IR/DIBuilder.h
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/include/llvm/IR/DiagnosticInfo.h
llvm/include/llvm/IR/Dominators.h
llvm/include/llvm/IR/IRBuilder.h
llvm/include/llvm/IR/IRPrintingPasses.h
llvm/include/llvm/IR/Instruction.h
llvm/include/llvm/IR/Instructions.h
llvm/include/llvm/IR/LLVMContext.h
llvm/include/llvm/IR/LLVMRemarkStreamer.h
llvm/include/llvm/IR/LegacyPassManager.h
llvm/include/llvm/IR/MDBuilder.h
llvm/include/llvm/IR/Metadata.h
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/include/llvm/IR/PassManager.h
llvm/include/llvm/IR/PassTimingInfo.h
llvm/include/llvm/IR/ReplaceConstant.h
llvm/include/llvm/IR/SSAContext.h
llvm/include/llvm/IR/Statepoint.h
llvm/include/llvm/IR/Type.h
llvm/include/llvm/IR/Use.h
llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h
llvm/include/llvm/Transforms/IPO/AlwaysInliner.h
llvm/include/llvm/Transforms/IPO/ForceFunctionAttrs.h
llvm/include/llvm/Transforms/IPO/InferFunctionAttrs.h
llvm/include/llvm/Transforms/IPO/SampleProfile.h
llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h
llvm/include/llvm/Transforms/Instrumentation/BoundsChecking.h
llvm/include/llvm/Transforms/Instrumentation/HWAddressSanitizer.h
llvm/include/llvm/Transforms/Instrumentation/MemProfiler.h
llvm/include/llvm/Transforms/Scalar/Scalarizer.h
llvm/include/llvm/Transforms/Scalar/WarnMissedTransforms.h
llvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
llvm/include/llvm/Transforms/Utils/Debugify.h
llvm/include/llvm/Transforms/Utils/InjectTLIMappings.h
llvm/include/llvm/Transforms/Vectorize/LoadStoreVectorizer.h
llvm/lib/IR/Attributes.cpp
llvm/lib/IR/AutoUpgrade.cpp
llvm/lib/IR/BasicBlock.cpp
llvm/lib/IR/Comdat.cpp
llvm/lib/IR/ConstantFold.cpp
llvm/lib/IR/Constants.cpp
llvm/lib/IR/Core.cpp
llvm/lib/IR/DIBuilder.cpp
llvm/lib/IR/DataLayout.cpp
llvm/lib/IR/DebugInfo.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/DebugLoc.cpp
llvm/lib/IR/DiagnosticInfo.cpp
llvm/lib/IR/Dominators.cpp
llvm/lib/IR/Function.cpp
llvm/lib/IR/Globals.cpp
llvm/lib/IR/IRBuilder.cpp
llvm/lib/IR/InlineAsm.cpp
llvm/lib/IR/Instruction.cpp
llvm/lib/IR/IntrinsicInst.cpp
llvm/lib/IR/LLVMContext.cpp
llvm/lib/IR/LLVMContextImpl.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/lib/IR/LLVMRemarkStreamer.cpp
llvm/lib/IR/LegacyPassManager.cpp
llvm/lib/IR/Metadata.cpp
llvm/lib/IR/Module.cpp
llvm/lib/IR/ModuleSummaryIndex.cpp
llvm/lib/IR/Operator.cpp
llvm/lib/IR/OptBisect.cpp
llvm/lib/IR/PassManager.cpp
llvm/lib/IR/ProfileSummary.cpp
llvm/lib/IR/PseudoProbe.cpp
llvm/lib/IR/ReplaceConstant.cpp
llvm/lib/IR/SSAContext.cpp
llvm/lib/IR/SafepointIRVerifier.cpp
llvm/lib/IR/Statepoint.cpp
llvm/lib/IR/Type.cpp
llvm/lib/IR/Use.cpp
llvm/lib/IR/Value.cpp
llvm/lib/IR/Verifier.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Target/AMDGPU/AMDGPU.h
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
llvm/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp
llvm/lib/Target/X86/X86LowerAMXType.cpp
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
llvm/lib/Transforms/IPO/CalledValuePropagation.cpp
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/lib/Transforms/IPO/SampleProfileProbe.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/lib/Transforms/Instrumentation/MemProfiler.cpp
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/lib/Transforms/Utils/Local.cpp
llvm/lib/Transforms/Utils/NameAnonGlobals.cpp
llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
llvm/lib/Transforms/Utils/Utils.cpp
llvm/lib/Transforms/Utils/VNCoercion.cpp
llvm/lib/Transforms/Vectorize/Vectorize.cpp
llvm/tools/llvm-c-test/echo.cpp
llvm/tools/llvm-extract/llvm-extract.cpp
llvm/tools/llvm-stress/llvm-stress.cpp
llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
llvm/unittests/IR/TimePassesTest.cpp
llvm/unittests/Transforms/Utils/LocalTest.cpp
polly/include/polly/Support/DumpFunctionPass.h