Remove unused LLVMFunction class
authorChristoph Egger <Christoph.Egger@fau.de>
Fri, 20 Feb 2015 16:23:09 +0000 (17:23 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Fri, 20 Feb 2015 16:23:09 +0000 (17:23 +0100)
src/disassembler/llvm/LLVMDisassembler.cxx
src/disassembler/llvm/LLVMDisassembler.hxx
src/disassembler/llvm/LLVMFunction.hxx [deleted file]

index d2c68fdce4f4f48f803c90726a2707565007d8fc..fbbbc94279f766b6c8f3dac2375312c0f9dce79e 100644 (file)
@@ -1,7 +1,7 @@
 #include "disassembler/llvm/LLVMDisassembler.hxx"
 #include "disassembler/llvm/LLVMBasicBlock.hxx"
-#include "disassembler/llvm/LLVMFunction.hxx"
 #include "core/InformationManager.hxx"
+#include "core/Function.hxx"
 
 #include <stack>
 #include <algorithm>
@@ -188,13 +188,13 @@ Function* LLVMDisassembler<ELFT>::disassembleFunctionAt(uint64_t address, const
                return functions[address];
        }
 
-       LLVMFunction * function;
+       Function * function;
        if (name == "") {
                std::stringstream s;
                s << "<Unnamed 0x" << std::hex << address << ">";
-               function = new LLVMFunction(s.str(), address);
+               function = new Function(s.str(), address);
        } else {
-               function = new LLVMFunction(name, address);
+               function = new Function(name, address);
        }
        functions.insert(std::make_pair(address, function));
 
@@ -204,7 +204,7 @@ Function* LLVMDisassembler<ELFT>::disassembleFunctionAt(uint64_t address, const
 }
 
 template <typename ELFT>
-void LLVMDisassembler<ELFT>::disassembleFunction(LLVMFunction* function) {
+void LLVMDisassembler<ELFT>::disassembleFunction(Function* function) {
        std::stack<LLVMBasicBlock*> remaining_blocks;
        SectionRef text_section = sections[".text"];
        StringRef bytes;
@@ -293,7 +293,7 @@ void LLVMDisassembler<ELFT>::disassembleFunction(LLVMFunction* function) {
 template <typename ELFT>
 void LLVMDisassembler<ELFT>::disassemble() {
        SectionRef text_section = sections[".text"];
-       std::vector<LLVMFunction*> remaining_functions;
+       std::vector<Function*> remaining_functions;
 
        // Assume all function symbols actually start a real function
        for (auto x = symbols.begin(); x != symbols.end(); ++x) {
@@ -310,14 +310,14 @@ void LLVMDisassembler<ELFT>::disassemble() {
                        continue;
 
                if (!x->second.getAddress(result)) {
-                       LLVMFunction * fun = new LLVMFunction(x->first, result);
+                       Function * fun = new Function(x->first, result);
                        remaining_functions.push_back(fun);
                        functions.insert(std::make_pair(result, fun));
                        LOG4CXX_DEBUG(logger, "Disasembling " << x->first);
                }
        }
 
-       for (LLVMFunction* function : remaining_functions) {
+       for (Function* function : remaining_functions) {
                disassembleFunction(function);
        }
 
@@ -342,7 +342,7 @@ void LLVMDisassembler<ELFT>::disassemble() {
 }
 
 template <typename ELFT>
-void LLVMDisassembler<ELFT>::splitBlocks(LLVMFunction* function) {
+void LLVMDisassembler<ELFT>::splitBlocks(Function* function) {
        SectionRef text_section = sections[".text"];
        StringRef bytes;
        text_section.getContents(bytes);
@@ -443,7 +443,7 @@ void LLVMDisassembler<ELFT>::readSections() {
 template <typename ELFT>
 void LLVMDisassembler<ELFT>::forEachFunction(std::function<void (uint64_t, Function*)> callback) {
        std::for_each(functions.begin(), functions.end(),
-                     [&](std::pair<uint64_t, LLVMFunction*> x) {
+                     [&](std::pair<uint64_t, Function*> x) {
                              callback(x.first, x.second);
                      });
 }
index 2291e205d4ccadede3acff7bb173579df9de9b91..2713ac6f32f561df00e252a53b0678c4fe6cc4d9 100644 (file)
@@ -11,7 +11,6 @@
 
 class Function;
 class BasicBlock;
-class LLVMFunction;
 class LLVMBasicBlock;
 
 Disassembler * createLLVMDisassembler(const std::string& filename, InformationManager* manager);
@@ -47,8 +46,8 @@ private:
        typedef llvm::object::ELFFile<ELFT> ELFO;
 
        // http://llvm.org/docs/doxygen/html/MCObjectDisassembler_8cpp_source.html +197
-       void disassembleFunction(LLVMFunction* function);
-       void splitBlocks(LLVMFunction* fun);
+       void disassembleFunction(Function* function);
+       void splitBlocks(Function* fun);
        void disassemble();
 
        void readSymbols();
@@ -57,7 +56,7 @@ private:
 
        log4cxx::LoggerPtr logger;
        std::map<uint64_t, LLVMBasicBlock*> blocks;
-       std::map<uint64_t, LLVMFunction*> functions;
+       std::map<uint64_t, Function*> functions;
 
        llvm::Triple triple;
        std::shared_ptr<llvm::object::Binary> binary;
diff --git a/src/disassembler/llvm/LLVMFunction.hxx b/src/disassembler/llvm/LLVMFunction.hxx
deleted file mode 100644 (file)
index e28b958..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef INCLUDE__LLVMFunction_hxx
-#define INCLUDE__LLVMFunction_hxx
-
-#include "core/Function.hxx"
-
-class LLVMFunction : public Function {
-public:
-       LLVMFunction(const std::string& name, uint64_t start_address)
-               :Function(name, start_address) {}
-private:
-};
-
-#endif