]> git.siccegge.de Git - frida/frida.git/commitdiff
Remove unused LLVMBasicBlock class
authorChristoph Egger <Christoph.Egger@fau.de>
Fri, 20 Feb 2015 16:29:13 +0000 (17:29 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Fri, 20 Feb 2015 16:29:41 +0000 (17:29 +0100)
src/core/BasicBlock.hxx
src/disassembler/llvm/LLVMBasicBlock.hxx [deleted file]
src/disassembler/llvm/LLVMDisassembler.cxx
src/disassembler/llvm/LLVMDisassembler.hxx

index b3e5a89d819cfbd74c5b375919eba6dcccd7e09a..0a759bf4d85875a2f153e14ba5cd4556d49f8c1b 100644 (file)
@@ -5,9 +5,13 @@
 #include <string>
 #include <sstream>
 
+class Disassembler;
+
 class BasicBlock {
 public:
-       BasicBlock() {
+       BasicBlock(uint64_t start_address, Disassembler * disassembler)
+               : start_address(start_address)
+               , disassembler(disassembler) {
                next_blocks[0] = 0;
                next_blocks[1] = 0;
        }
@@ -44,10 +48,14 @@ public:
                return s.str();
        }
 
+       Disassembler * getDisassembler() {
+               return disassembler;
+       }
+
 private:
        uint64_t start_address;
        uint64_t end_address;
-
+       Disassembler* disassembler;
        uint64_t next_blocks[2];
 };
 
diff --git a/src/disassembler/llvm/LLVMBasicBlock.hxx b/src/disassembler/llvm/LLVMBasicBlock.hxx
deleted file mode 100644 (file)
index 15826aa..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef INCLUDE__LLVMBasicBlock_hxx
-#define INCLUDE__LLVMBasicBlock_hxx
-
-#include "core/BasicBlock.hxx"
-
-class Disassembler;
-
-class LLVMBasicBlock : public BasicBlock {
-public:
-       LLVMBasicBlock(uint64_t start_address, Disassembler * disassembler) {
-               setStartAddress(start_address);
-       }
-
-       Disassembler * getDisassembler() {
-               return disassembler;
-       }
-
-private:
-       Disassembler * disassembler;
-};
-
-#endif
index fbbbc94279f766b6c8f3dac2375312c0f9dce79e..1d4f2dff725064ecb64dd6cfd7a8d6c0de68d766 100644 (file)
@@ -1,7 +1,7 @@
 #include "disassembler/llvm/LLVMDisassembler.hxx"
-#include "disassembler/llvm/LLVMBasicBlock.hxx"
 #include "core/InformationManager.hxx"
 #include "core/Function.hxx"
+#include "core/BasicBlock.hxx"
 
 #include <stack>
 #include <algorithm>
@@ -205,7 +205,7 @@ Function* LLVMDisassembler<ELFT>::disassembleFunctionAt(uint64_t address, const
 
 template <typename ELFT>
 void LLVMDisassembler<ELFT>::disassembleFunction(Function* function) {
-       std::stack<LLVMBasicBlock*> remaining_blocks;
+       std::stack<BasicBlock*> remaining_blocks;
        SectionRef text_section = sections[".text"];
        StringRef bytes;
        text_section.getContents(bytes);
@@ -213,13 +213,13 @@ void LLVMDisassembler<ELFT>::disassembleFunction(Function* function) {
 
        LOG4CXX_DEBUG(logger, "Handling function " << function->getName());
 
-       LLVMBasicBlock * block = new LLVMBasicBlock(function->getStartAddress(), this);
+       BasicBlock * block = new BasicBlock(function->getStartAddress(), this);
        remaining_blocks.push(block);
        blocks.insert(std::make_pair(block->getStartAddress(), block));
        function->addBasicBlock(block);
 
        while (remaining_blocks.size()) {
-               LLVMBasicBlock * current_block = remaining_blocks.top();
+               BasicBlock * current_block = remaining_blocks.top();
                remaining_blocks.pop();
 
                LOG4CXX_DEBUG(logger, "Handling Block starting at " << std::hex << current_block->getStartAddress());
@@ -247,7 +247,7 @@ void LLVMDisassembler<ELFT>::disassembleFunction(Function* function) {
                                                } else {
                                                        current_block->setNextBlock(0, jmptarget);
                                                        if (blocks.find(jmptarget) == blocks.end()) {
-                                                               LLVMBasicBlock * block = new LLVMBasicBlock(jmptarget, this);
+                                                               BasicBlock * block = new BasicBlock(jmptarget, this);
                                                                blocks.insert(std::make_pair(block->getStartAddress(), block));
                                                                function->addBasicBlock(block);
                                                                remaining_blocks.push(block);
@@ -259,7 +259,7 @@ void LLVMDisassembler<ELFT>::disassembleFunction(Function* function) {
                                                                jmptarget = base_address + current_address + inst_size;
                                                                current_block->setNextBlock(1, jmptarget);
                                                                if (blocks.find(jmptarget) == blocks.end()) {
-                                                                       LLVMBasicBlock * block = new LLVMBasicBlock(jmptarget, this);
+                                                                       BasicBlock * block = new BasicBlock(jmptarget, this);
                                                                        blocks.insert(std::make_pair(block->getStartAddress(), block));
                                                                        function->addBasicBlock(block);
                                                                        remaining_blocks.push(block);
index 2713ac6f32f561df00e252a53b0678c4fe6cc4d9..426cc89053e932a9eeeb0ee3e6060ec87277336e 100644 (file)
@@ -11,7 +11,6 @@
 
 class Function;
 class BasicBlock;
-class LLVMBasicBlock;
 
 Disassembler * createLLVMDisassembler(const std::string& filename, InformationManager* manager);
 
@@ -55,7 +54,7 @@ private:
        void readDynamicSymbols();
 
        log4cxx::LoggerPtr logger;
-       std::map<uint64_t, LLVMBasicBlock*> blocks;
+       std::map<uint64_t, BasicBlock*> blocks;
        std::map<uint64_t, Function*> functions;
 
        llvm::Triple triple;