[llvm] 42c7f49 - [tools] Forward declare classes & remove includes
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 3 16:32:09 PDT 2022
Author: Clemens Wasser
Date: 2022-06-03T16:32:04-07:00
New Revision: 42c7f494d93fcb96f4fef7bd9a7b76a6a96cc504
URL: https://github.com/llvm/llvm-project/commit/42c7f494d93fcb96f4fef7bd9a7b76a6a96cc504
DIFF: https://github.com/llvm/llvm-project/commit/42c7f494d93fcb96f4fef7bd9a7b76a6a96cc504.diff
LOG: [tools] Forward declare classes & remove includes
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120208
Added:
Modified:
llvm/tools/dsymutil/Reproducer.h
llvm/tools/llvm-exegesis/lib/PerfHelper.h
llvm/tools/llvm-ifs/ErrorCollector.h
llvm/tools/llvm-mca/Views/InstructionView.h
llvm/tools/llvm-pdbutil/OutputStyle.h
llvm/tools/llvm-reduce/DeltaManager.cpp
llvm/tools/llvm-reduce/ReducerWorkItem.cpp
llvm/tools/llvm-reduce/TestRunner.cpp
llvm/tools/llvm-reduce/TestRunner.h
llvm/tools/llvm-reduce/deltas/Delta.cpp
llvm/tools/llvm-reduce/deltas/Delta.h
llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
llvm/tools/llvm-reduce/llvm-reduce.cpp
llvm/tools/opt/NewPMDriver.h
Removed:
################################################################################
diff --git a/llvm/tools/dsymutil/Reproducer.h b/llvm/tools/dsymutil/Reproducer.h
index e965e1ceda249..a53b97f7ca9f4 100644
--- a/llvm/tools/dsymutil/Reproducer.h
+++ b/llvm/tools/dsymutil/Reproducer.h
@@ -9,7 +9,6 @@
#ifndef LLVM_TOOLS_DSYMUTIL_REPRODUCER_H
#define LLVM_TOOLS_DSYMUTIL_REPRODUCER_H
-#include "llvm/Support/Error.h"
#include "llvm/Support/FileCollector.h"
#include "llvm/Support/VirtualFileSystem.h"
diff --git a/llvm/tools/llvm-exegesis/lib/PerfHelper.h b/llvm/tools/llvm-exegesis/lib/PerfHelper.h
index 19a35595c9af7..506917f16cdcb 100644
--- a/llvm/tools/llvm-exegesis/lib/PerfHelper.h
+++ b/llvm/tools/llvm-exegesis/lib/PerfHelper.h
@@ -14,7 +14,6 @@
#ifndef LLVM_TOOLS_LLVM_EXEGESIS_PERFHELPER_H
#define LLVM_TOOLS_LLVM_EXEGESIS_PERFHELPER_H
-#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Config/config.h"
diff --git a/llvm/tools/llvm-ifs/ErrorCollector.h b/llvm/tools/llvm-ifs/ErrorCollector.h
index 7217ca3b859e8..d3a814b94ae7a 100644
--- a/llvm/tools/llvm-ifs/ErrorCollector.h
+++ b/llvm/tools/llvm-ifs/ErrorCollector.h
@@ -21,10 +21,13 @@
#ifndef LLVM_TOOLS_LLVM_IFS_ERRORCOLLECTOR_H
#define LLVM_TOOLS_LLVM_IFS_ERRORCOLLECTOR_H
-#include "llvm/Support/Error.h"
+#include "llvm/Support/raw_ostream.h"
#include <vector>
namespace llvm {
+
+class Error;
+
namespace ifs {
class ErrorCollector {
diff --git a/llvm/tools/llvm-mca/Views/InstructionView.h b/llvm/tools/llvm-mca/Views/InstructionView.h
index cec07eef6a807..ae57246fc35f3 100644
--- a/llvm/tools/llvm-mca/Views/InstructionView.h
+++ b/llvm/tools/llvm-mca/Views/InstructionView.h
@@ -17,9 +17,10 @@
#include "llvm/MCA/View.h"
#include "llvm/Support/JSON.h"
-#include "llvm/Support/raw_ostream.h"
namespace llvm {
+class MCInstPrinter;
+
namespace mca {
// The base class for views that deal with individual machine instructions.
diff --git a/llvm/tools/llvm-pdbutil/OutputStyle.h b/llvm/tools/llvm-pdbutil/OutputStyle.h
index da93c32053f35..8cc9016d79a28 100644
--- a/llvm/tools/llvm-pdbutil/OutputStyle.h
+++ b/llvm/tools/llvm-pdbutil/OutputStyle.h
@@ -9,9 +9,10 @@
#ifndef LLVM_TOOLS_LLVMPDBDUMP_OUTPUTSTYLE_H
#define LLVM_TOOLS_LLVMPDBDUMP_OUTPUTSTYLE_H
-#include "llvm/Support/Error.h"
-
namespace llvm {
+
+class Error;
+
namespace pdb {
class OutputStyle {
diff --git a/llvm/tools/llvm-reduce/DeltaManager.cpp b/llvm/tools/llvm-reduce/DeltaManager.cpp
index ed9d105223db9..fa81a6996d5ee 100644
--- a/llvm/tools/llvm-reduce/DeltaManager.cpp
+++ b/llvm/tools/llvm-reduce/DeltaManager.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "DeltaManager.h"
+#include "ReducerWorkItem.h"
#include "TestRunner.h"
#include "deltas/Delta.h"
#include "deltas/ReduceAliases.h"
diff --git a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
index fbae2a6ba8498..fc247d869e38f 100644
--- a/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
+++ b/llvm/tools/llvm-reduce/ReducerWorkItem.cpp
@@ -14,6 +14,7 @@
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/IR/Verifier.h"
diff --git a/llvm/tools/llvm-reduce/TestRunner.cpp b/llvm/tools/llvm-reduce/TestRunner.cpp
index 6c9299797b354..228e54ac83adb 100644
--- a/llvm/tools/llvm-reduce/TestRunner.cpp
+++ b/llvm/tools/llvm-reduce/TestRunner.cpp
@@ -7,6 +7,8 @@
//===----------------------------------------------------------------------===//
#include "TestRunner.h"
+#include "ReducerWorkItem.h"
+#include "llvm/CodeGen/MachineFunction.h"
using namespace llvm;
@@ -45,3 +47,8 @@ int TestRunner::run(StringRef Filename) {
return !Result;
}
+
+void TestRunner::setProgram(std::unique_ptr<ReducerWorkItem> P) {
+ assert(P && "Setting null program?");
+ Program = std::move(P);
+}
diff --git a/llvm/tools/llvm-reduce/TestRunner.h b/llvm/tools/llvm-reduce/TestRunner.h
index 1074902554aac..8c0b843a846b3 100644
--- a/llvm/tools/llvm-reduce/TestRunner.h
+++ b/llvm/tools/llvm-reduce/TestRunner.h
@@ -37,10 +37,7 @@ class TestRunner {
/// Returns the most reduced version of the original testcase
ReducerWorkItem &getProgram() const { return *Program; }
- void setProgram(std::unique_ptr<ReducerWorkItem> P) {
- assert(P && "Setting null program?");
- Program = std::move(P);
- }
+ void setProgram(std::unique_ptr<ReducerWorkItem> P);
const TargetMachine *getTargetMachine() const { return TM.get(); }
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 3533afac0850f..94fa1d936653c 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -17,6 +17,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/Bitcode/BitcodeWriter.h"
+#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/IR/Verifier.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ThreadPool.h"
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.h b/llvm/tools/llvm-reduce/deltas/Delta.h
index 76aaf25044826..016400230a4f3 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.h
+++ b/llvm/tools/llvm-reduce/deltas/Delta.h
@@ -23,6 +23,8 @@
namespace llvm {
+class MachineFunction;
+
struct Chunk {
int Begin;
int End;
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
index 975044901057b..f5f74f1bb4d6e 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructionsMIR.cpp
@@ -14,6 +14,7 @@
#include "ReduceInstructionsMIR.h"
#include "Delta.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp
index 5581745ff22e2..362136f26219a 100644
--- a/llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -19,6 +19,8 @@
#include "TestRunner.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/CodeGen/CommandFlags.h"
+#include "llvm/CodeGen/MachineFunction.h"
+#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IRReader/IRReader.h"
diff --git a/llvm/tools/opt/NewPMDriver.h b/llvm/tools/opt/NewPMDriver.h
index 40f40a0bc8c1f..16bb205afdcac 100644
--- a/llvm/tools/opt/NewPMDriver.h
+++ b/llvm/tools/opt/NewPMDriver.h
@@ -20,7 +20,6 @@
#ifndef LLVM_TOOLS_OPT_NEWPMDRIVER_H
#define LLVM_TOOLS_OPT_NEWPMDRIVER_H
-#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/CommandLine.h"
namespace llvm {
More information about the llvm-commits
mailing list