Skip to content

Commit e188aae

Browse files
author
serge-sans-paille
committed
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
1 parent 5a5037c commit e188aae

File tree

118 files changed

+185
-133
lines changed

Some content is hidden

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

118 files changed

+185
-133
lines changed

clang/lib/CodeGen/CGStmtOpenMP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "llvm/IR/Constants.h"
3131
#include "llvm/IR/DebugInfoMetadata.h"
3232
#include "llvm/IR/Instructions.h"
33+
#include "llvm/IR/IntrinsicInst.h"
3334
#include "llvm/IR/Metadata.h"
3435
#include "llvm/Support/AtomicOrdering.h"
3536
using namespace clang;

llvm/examples/IRTransforms/InitializePasses.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#define LLVM_EXAMPLES_IRTRANSFORMS_INITIALIZEPASSES__H
1212

1313
#include "llvm/IR/PassManager.h"
14+
#include "llvm/PassRegistry.h"
1415

1516
namespace llvm {
1617

llvm/include/llvm-c/Core.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#define LLVM_C_CORE_H
1717

1818
#include "llvm-c/Deprecated.h"
19-
#include "llvm-c/ErrorHandling.h"
2019
#include "llvm-c/ExternC.h"
2120
#include "llvm-c/Types.h"
2221

llvm/include/llvm-c/DebugInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#ifndef LLVM_C_DEBUGINFO_H
1717
#define LLVM_C_DEBUGINFO_H
1818

19-
#include "llvm-c/Core.h"
2019
#include "llvm-c/ExternC.h"
20+
#include "llvm-c/Types.h"
2121

2222
LLVM_C_EXTERN_C_BEGIN
2323

llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h

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

2727
#include "llvm/IR/Function.h"
2828
#include "llvm/IR/PassManager.h"
29+
#include "llvm/Pass.h"
2930

3031
namespace llvm {
3132
class AAResults;

llvm/include/llvm/Analysis/CycleAnalysis.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/ADT/GenericCycleInfo.h"
1919
#include "llvm/IR/PassManager.h"
2020
#include "llvm/IR/SSAContext.h"
21+
#include "llvm/Pass.h"
2122

2223
namespace llvm {
2324
extern template class GenericCycleInfo<SSAContext>;

llvm/include/llvm/Analysis/MLInlineAdvisor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/IR/PassManager.h"
1616

1717
#include <deque>
18+
#include <map>
1819
#include <memory>
1920

2021
namespace llvm {

llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/IR/PassManager.h"
2424
#include "llvm/IR/PredIteratorCache.h"
2525
#include "llvm/IR/ValueHandle.h"
26+
#include "llvm/Pass.h"
2627

2728
namespace llvm {
2829

llvm/include/llvm/Analysis/SparsePropagation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_ANALYSIS_SPARSEPROPAGATION_H
1515
#define LLVM_ANALYSIS_SPARSEPROPAGATION_H
1616

17+
#include "llvm/ADT/SmallPtrSet.h"
1718
#include "llvm/IR/Instructions.h"
1819
#include "llvm/Support/Debug.h"
1920
#include <set>

llvm/include/llvm/CodeGen/ReplaceWithVeclib.h

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

1717
#include "llvm/IR/PassManager.h"
1818
#include "llvm/InitializePasses.h"
19+
#include "llvm/Pass.h"
1920

2021
namespace llvm {
2122
struct ReplaceWithVeclib : public PassInfoMixin<ReplaceWithVeclib> {

0 commit comments

Comments
 (0)