From 32e87746db981882b95aceddde79ef12034a3405 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Fri, 20 Feb 2015 17:03:45 +0100 Subject: [PATCH] Move Function/BasicBlock to core and clean up includes Function and BasicBlock are considered part od the Data Model and part of the core. Move them there. Also remove lots of #include from the headers and replace them by forward declarations. This should make compilation units smaller and remove the huge number of users for each header -- speeding up compilation and making users explicitely include stuff they use. --- src/{disassembler => core}/BasicBlock.hxx | 0 src/{disassembler => core}/Function.hxx | 2 +- src/core/InformationManager.cxx | 7 +++++-- src/core/InformationManager.hxx | 1 + src/disassembler/Disassembler.hxx | 6 +++--- src/disassembler/llvm/LLVMBasicBlock.hxx | 2 +- src/disassembler/llvm/LLVMDisassembler.cxx | 1 + src/disassembler/llvm/LLVMDisassembler.hxx | 8 ++++---- src/disassembler/llvm/LLVMFunction.hxx | 2 +- src/gui/Mainwindow.cxx | 5 ++++- src/gui/Mainwindow.hxx | 9 +++++---- src/gui/widgets/BasicBlockWidget.cxx | 1 + src/gui/widgets/BasicBlockWidget.hxx | 2 +- 13 files changed, 28 insertions(+), 18 deletions(-) rename src/{disassembler => core}/BasicBlock.hxx (100%) rename src/{disassembler => core}/Function.hxx (94%) diff --git a/src/disassembler/BasicBlock.hxx b/src/core/BasicBlock.hxx similarity index 100% rename from src/disassembler/BasicBlock.hxx rename to src/core/BasicBlock.hxx diff --git a/src/disassembler/Function.hxx b/src/core/Function.hxx similarity index 94% rename from src/disassembler/Function.hxx rename to src/core/Function.hxx index 57833ba..3c8f799 100644 --- a/src/disassembler/Function.hxx +++ b/src/core/Function.hxx @@ -1,8 +1,8 @@ #ifndef INCLUDE__Function_hxx #define INCLUDE__Function_hxx -#include "disassembler/BasicBlock.hxx" #include +#include "BasicBlock.hxx" class Function { public: diff --git a/src/core/InformationManager.cxx b/src/core/InformationManager.cxx index 0907cf9..7c1c5de 100644 --- a/src/core/InformationManager.cxx +++ b/src/core/InformationManager.cxx @@ -1,8 +1,11 @@ #include "InformationManager.hxx" #include "disassembler/llvm/LLVMDisassembler.hxx" +#include "core/Function.hxx" +#include "core/BasicBlock.hxx" + #include "gui/qt.hxx" -#include "quazip/quazip.h" -#include "quazip/quazipfile.h" +#include +#include void InformationManager::reset(const std::string& filename) { disassembler.reset(createLLVMDisassembler(filename, this)); diff --git a/src/core/InformationManager.hxx b/src/core/InformationManager.hxx index 4e1b318..f8e4f04 100644 --- a/src/core/InformationManager.hxx +++ b/src/core/InformationManager.hxx @@ -8,6 +8,7 @@ class Disassembler; class Function; +class BasicBlock; class QString; diff --git a/src/disassembler/Disassembler.hxx b/src/disassembler/Disassembler.hxx index dbc140e..4feeddf 100644 --- a/src/disassembler/Disassembler.hxx +++ b/src/disassembler/Disassembler.hxx @@ -4,9 +4,9 @@ #include #include -#include "disassembler/BasicBlock.hxx" -#include "disassembler/Function.hxx" -#include "core/InformationManager.hxx" +class Function; +class BasicBlock; +class InformationManager; class Disassembler { public: diff --git a/src/disassembler/llvm/LLVMBasicBlock.hxx b/src/disassembler/llvm/LLVMBasicBlock.hxx index 0949f70..15826aa 100644 --- a/src/disassembler/llvm/LLVMBasicBlock.hxx +++ b/src/disassembler/llvm/LLVMBasicBlock.hxx @@ -1,7 +1,7 @@ #ifndef INCLUDE__LLVMBasicBlock_hxx #define INCLUDE__LLVMBasicBlock_hxx -#include "disassembler/BasicBlock.hxx" +#include "core/BasicBlock.hxx" class Disassembler; diff --git a/src/disassembler/llvm/LLVMDisassembler.cxx b/src/disassembler/llvm/LLVMDisassembler.cxx index 5652cfb..3147796 100644 --- a/src/disassembler/llvm/LLVMDisassembler.cxx +++ b/src/disassembler/llvm/LLVMDisassembler.cxx @@ -1,6 +1,7 @@ #include "disassembler/llvm/LLVMDisassembler.hxx" #include "disassembler/llvm/LLVMBasicBlock.hxx" #include "disassembler/llvm/LLVMFunction.hxx" +#include "core/InformationManager.hxx" #include #include diff --git a/src/disassembler/llvm/LLVMDisassembler.hxx b/src/disassembler/llvm/LLVMDisassembler.hxx index 95e961f..2291e20 100644 --- a/src/disassembler/llvm/LLVMDisassembler.hxx +++ b/src/disassembler/llvm/LLVMDisassembler.hxx @@ -8,11 +8,11 @@ #include "include_llvm.hxx" #include "disassembler/Disassembler.hxx" -#include "disassembler/BasicBlock.hxx" -#include "disassembler/Function.hxx" -#include "disassembler/llvm/LLVMBasicBlock.hxx" -#include "disassembler/llvm/LLVMFunction.hxx" +class Function; +class BasicBlock; +class LLVMFunction; +class LLVMBasicBlock; Disassembler * createLLVMDisassembler(const std::string& filename, InformationManager* manager); diff --git a/src/disassembler/llvm/LLVMFunction.hxx b/src/disassembler/llvm/LLVMFunction.hxx index 0bdb1dc..e28b958 100644 --- a/src/disassembler/llvm/LLVMFunction.hxx +++ b/src/disassembler/llvm/LLVMFunction.hxx @@ -1,7 +1,7 @@ #ifndef INCLUDE__LLVMFunction_hxx #define INCLUDE__LLVMFunction_hxx -#include "disassembler/Function.hxx" +#include "core/Function.hxx" class LLVMFunction : public Function { public: diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 03910a1..4d6e2c0 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -1,7 +1,10 @@ #include "Mainwindow.hxx" #include "qt.hxx" #include "disassembler/llvm/LLVMDisassembler.hxx" - +#include "core/Function.hxx" +#include "core/BasicBlock.hxx" +#include "core/InformationManager.hxx" +#include "widgets/ScriptingDock.hxx" #include "widgets/CFGScene.hxx" #include "dialogs/NewFunctionDialog.hxx" #include "dialogs/SimpleStringDialog.hxx" diff --git a/src/gui/Mainwindow.hxx b/src/gui/Mainwindow.hxx index 0962efd..8cf1fad 100644 --- a/src/gui/Mainwindow.hxx +++ b/src/gui/Mainwindow.hxx @@ -13,10 +13,11 @@ #include -#include "disassembler/Disassembler.hxx" -#include "widgets/BasicBlockWidget.hxx" -#include "widgets/ScriptingDock.hxx" -#include "core/InformationManager.hxx" +class Disassembler; +class Function; +class InformationManager; +class BasicBlockWidget; +class ScriptingDock; class Mainwindow : public QMainWindow { Q_OBJECT diff --git a/src/gui/widgets/BasicBlockWidget.cxx b/src/gui/widgets/BasicBlockWidget.cxx index fbf4370..b9a1b14 100644 --- a/src/gui/widgets/BasicBlockWidget.cxx +++ b/src/gui/widgets/BasicBlockWidget.cxx @@ -1,6 +1,7 @@ #include "BasicBlockWidget.hxx" #include "gui/Mainwindow.hxx" #include "gui/dialogs/SimpleStringDialog.hxx" +#include "core/BasicBlock.hxx" class CustomQGraphicsTextItem : public QObject, public QGraphicsTextItem { public: diff --git a/src/gui/widgets/BasicBlockWidget.hxx b/src/gui/widgets/BasicBlockWidget.hxx index 5d23d9b..2c9cec3 100644 --- a/src/gui/widgets/BasicBlockWidget.hxx +++ b/src/gui/widgets/BasicBlockWidget.hxx @@ -2,7 +2,6 @@ #define INCLUDE__BasicBlockWidget_hxx #include "gui/qt.hxx" -#include "disassembler/BasicBlock.hxx" #include #include #include @@ -10,6 +9,7 @@ #include class Mainwindow; +class BasicBlock; class BasicBlockWidget : public QObject, public QGraphicsItem { -- 2.39.5