Skip to content

Commit 2010de3

Browse files
committed
Trim and tidy includes in rustc_llvm
1 parent b8c8287 commit 2010de3

File tree

5 files changed

+39
-77
lines changed

5 files changed

+39
-77
lines changed

compiler/rustc_llvm/llvm-wrapper/CoverageMappingWrapper.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#include "LLVMWrapper.h"
2+
23
#include "llvm/ADT/ArrayRef.h"
4+
#include "llvm/ADT/StringRef.h"
5+
#include "llvm/IR/GlobalVariable.h"
6+
#include "llvm/IR/Module.h"
37
#include "llvm/ProfileData/Coverage/CoverageMapping.h"
48
#include "llvm/ProfileData/Coverage/CoverageMappingWriter.h"
59
#include "llvm/ProfileData/InstrProf.h"

compiler/rustc_llvm/llvm-wrapper/LLVMWrapper.h

+7-43
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,18 @@
1+
#ifndef RUSTC_LLVM_LLVMWRAPPER_H
2+
#define RUSTC_LLVM_LLVMWRAPPER_H
3+
14
#include "SuppressLLVMWarnings.h"
25

3-
#include "llvm-c/BitReader.h"
4-
#include "llvm-c/Core.h"
5-
#include "llvm-c/Object.h"
6-
#include "llvm/ADT/ArrayRef.h"
7-
#include "llvm/ADT/DenseSet.h"
8-
#include "llvm/ADT/SmallVector.h"
9-
#include "llvm/Analysis/Lint.h"
10-
#include "llvm/Analysis/Passes.h"
11-
#include "llvm/IR/IRBuilder.h"
12-
#include "llvm/IR/InlineAsm.h"
13-
#include "llvm/IR/LLVMContext.h"
14-
#include "llvm/IR/Module.h"
15-
#include "llvm/Support/CommandLine.h"
16-
#include "llvm/Support/Debug.h"
17-
#include "llvm/Support/DynamicLibrary.h"
18-
#include "llvm/Support/FormattedStream.h"
19-
#include "llvm/Support/JSON.h"
20-
#include "llvm/Support/Memory.h"
21-
#include "llvm/Support/SourceMgr.h"
22-
#include "llvm/Support/TargetSelect.h"
23-
#include "llvm/Support/Timer.h"
246
#include "llvm/Support/raw_ostream.h"
25-
#include "llvm/Target/TargetMachine.h"
26-
#include "llvm/Target/TargetOptions.h"
27-
#include "llvm/Transforms/IPO.h"
28-
#include "llvm/Transforms/Scalar.h"
7+
#include <cstddef>
8+
#include <cstdint>
299

3010
#define LLVM_VERSION_GE(major, minor) \
3111
(LLVM_VERSION_MAJOR > (major) || \
3212
LLVM_VERSION_MAJOR == (major) && LLVM_VERSION_MINOR >= (minor))
3313

3414
#define LLVM_VERSION_LT(major, minor) (!LLVM_VERSION_GE((major), (minor)))
3515

36-
#if LLVM_VERSION_GE(20, 0)
37-
#include "llvm/Transforms/Utils/Instrumentation.h"
38-
#else
39-
#include "llvm/Transforms/Instrumentation.h"
40-
#endif
41-
42-
#include "llvm/IR/LegacyPassManager.h"
43-
44-
#include "llvm/Bitcode/BitcodeReader.h"
45-
#include "llvm/Bitcode/BitcodeWriter.h"
46-
47-
#include "llvm/IR/DIBuilder.h"
48-
#include "llvm/IR/DebugInfo.h"
49-
#include "llvm/IR/IRPrintingPasses.h"
50-
#include "llvm/Linker/Linker.h"
51-
52-
#include "llvm/TargetParser/Triple.h"
53-
5416
extern "C" void LLVMRustSetLastError(const char *);
5517

5618
enum class LLVMRustResult { Success, Failure };
@@ -126,3 +88,5 @@ class RawRustStringOstream : public llvm::raw_ostream {
12688
flush();
12789
}
12890
};
91+
92+
#endif // RUSTC_LLVM_LLVMWRAPPER_H

compiler/rustc_llvm/llvm-wrapper/Linker.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
#include "llvm/Linker/Linker.h"
2-
#include "SuppressLLVMWarnings.h"
3-
41
#include "LLVMWrapper.h"
52

3+
#include "llvm/Bitcode/BitcodeReader.h"
4+
#include "llvm/IR/Module.h"
5+
#include "llvm/Linker/Linker.h"
6+
#include "llvm/Support/MemoryBuffer.h"
7+
68
using namespace llvm;
79

810
struct RustLinker {

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+11-20
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
1-
#include <stdio.h>
2-
3-
#include <cstddef>
4-
#include <iomanip>
5-
#include <set>
6-
#include <vector>
7-
81
#include "LLVMWrapper.h"
92

10-
#include "llvm/Analysis/AliasAnalysis.h"
3+
#include "llvm-c/Core.h"
4+
#include "llvm/Analysis/Lint.h"
115
#include "llvm/Analysis/TargetLibraryInfo.h"
12-
#include "llvm/Analysis/TargetTransformInfo.h"
136
#include "llvm/Bitcode/BitcodeWriter.h"
147
#include "llvm/CodeGen/CommandFlags.h"
15-
#include "llvm/CodeGen/TargetSubtargetInfo.h"
168
#include "llvm/IR/AssemblyAnnotationWriter.h"
179
#include "llvm/IR/AutoUpgrade.h"
18-
#include "llvm/IR/IntrinsicInst.h"
10+
#include "llvm/IR/LegacyPassManager.h"
1911
#include "llvm/IR/Verifier.h"
2012
#include "llvm/LTO/LTO.h"
13+
#include "llvm/MC/MCSubtargetInfo.h"
2114
#include "llvm/MC/TargetRegistry.h"
22-
#include "llvm/Object/IRObjectFile.h"
2315
#include "llvm/Object/ObjectFile.h"
2416
#include "llvm/Passes/PassBuilder.h"
2517
#include "llvm/Passes/PassPlugin.h"
2618
#include "llvm/Passes/StandardInstrumentations.h"
2719
#include "llvm/Support/CBindingWrapping.h"
2820
#include "llvm/Support/FileSystem.h"
29-
#include "llvm/Support/TimeProfiler.h"
3021
#include "llvm/Support/VirtualFileSystem.h"
3122
#include "llvm/Target/TargetMachine.h"
3223
#include "llvm/TargetParser/Host.h"
33-
#include "llvm/Transforms/IPO/AlwaysInliner.h"
3424
#include "llvm/Transforms/IPO/FunctionImport.h"
3525
#include "llvm/Transforms/IPO/Internalize.h"
3626
#include "llvm/Transforms/IPO/LowerTypeTests.h"
3727
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
3828
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
3929
#include "llvm/Transforms/Instrumentation/DataFlowSanitizer.h"
40-
#include "llvm/Transforms/Utils/AddDiscriminators.h"
41-
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
42-
#if LLVM_VERSION_GE(19, 0)
43-
#include "llvm/Support/PGOOptions.h"
44-
#endif
4530
#include "llvm/Transforms/Instrumentation/HWAddressSanitizer.h"
4631
#include "llvm/Transforms/Instrumentation/InstrProfiling.h"
4732
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
4833
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
49-
#include "llvm/Transforms/Utils.h"
5034
#include "llvm/Transforms/Utils/CanonicalizeAliases.h"
35+
#include "llvm/Transforms/Utils/FunctionImportUtils.h"
5136
#include "llvm/Transforms/Utils/NameAnonGlobals.h"
37+
#include <set>
38+
#include <vector>
39+
40+
#if LLVM_VERSION_GE(19, 0)
41+
#include "llvm/Support/PGOOptions.h"
42+
#endif
5243

5344
using namespace llvm;
5445

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
#include "LLVMWrapper.h"
2+
3+
#include "llvm-c/Core.h"
24
#include "llvm/ADT/Statistic.h"
5+
#include "llvm/ADT/StringRef.h"
6+
#include "llvm/BinaryFormat/Magic.h"
37
#include "llvm/Bitcode/BitcodeWriter.h"
8+
#include "llvm/IR/DIBuilder.h"
49
#include "llvm/IR/DebugInfoMetadata.h"
5-
#include "llvm/IR/DiagnosticHandler.h"
610
#include "llvm/IR/DiagnosticInfo.h"
711
#include "llvm/IR/DiagnosticPrinter.h"
8-
#include "llvm/IR/GlobalVariable.h"
12+
#include "llvm/IR/IRBuilder.h"
13+
#include "llvm/IR/InlineAsm.h"
914
#include "llvm/IR/Instructions.h"
10-
#include "llvm/IR/Intrinsics.h"
1115
#include "llvm/IR/IntrinsicsARM.h"
1216
#include "llvm/IR/LLVMRemarkStreamer.h"
1317
#include "llvm/IR/Mangler.h"
14-
#include "llvm/IR/Value.h"
15-
#include "llvm/Object/Archive.h"
18+
#include "llvm/IR/Module.h"
1619
#include "llvm/Object/COFFImportFile.h"
17-
#include "llvm/Object/ObjectFile.h"
18-
#include "llvm/Pass.h"
19-
#include "llvm/Remarks/RemarkFormat.h"
20-
#include "llvm/Remarks/RemarkSerializer.h"
2120
#include "llvm/Remarks/RemarkStreamer.h"
22-
#include "llvm/Support/ModRef.h"
21+
#include "llvm/Support/Compression.h"
22+
#include "llvm/Support/FileSystem.h"
23+
#include "llvm/Support/JSON.h"
2324
#include "llvm/Support/Signals.h"
25+
#include "llvm/Support/Timer.h"
2426
#include "llvm/Support/ToolOutputFile.h"
25-
2627
#include <iostream>
2728

2829
// for raw `write` in the bad-alloc handler

0 commit comments

Comments
 (0)