From: Christoph Egger Date: Fri, 20 Feb 2015 16:23:09 +0000 (+0100) Subject: Remove unused LLVMFunction class X-Git-Tag: v0.1~100 X-Git-Url: https://git.siccegge.de//index.cgi?a=commitdiff_plain;h=bc36ee5d21eac1d9bd1ab1c2e7003101dbbec604;p=frida%2Ffrida.git Remove unused LLVMFunction class --- diff --git a/src/disassembler/llvm/LLVMDisassembler.cxx b/src/disassembler/llvm/LLVMDisassembler.cxx index d2c68fd..fbbbc94 100644 --- a/src/disassembler/llvm/LLVMDisassembler.cxx +++ b/src/disassembler/llvm/LLVMDisassembler.cxx @@ -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 #include @@ -188,13 +188,13 @@ Function* LLVMDisassembler::disassembleFunctionAt(uint64_t address, const return functions[address]; } - LLVMFunction * function; + Function * function; if (name == "") { std::stringstream s; s << ""; - 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::disassembleFunctionAt(uint64_t address, const } template -void LLVMDisassembler::disassembleFunction(LLVMFunction* function) { +void LLVMDisassembler::disassembleFunction(Function* function) { std::stack remaining_blocks; SectionRef text_section = sections[".text"]; StringRef bytes; @@ -293,7 +293,7 @@ void LLVMDisassembler::disassembleFunction(LLVMFunction* function) { template void LLVMDisassembler::disassemble() { SectionRef text_section = sections[".text"]; - std::vector remaining_functions; + std::vector 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::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::disassemble() { } template -void LLVMDisassembler::splitBlocks(LLVMFunction* function) { +void LLVMDisassembler::splitBlocks(Function* function) { SectionRef text_section = sections[".text"]; StringRef bytes; text_section.getContents(bytes); @@ -443,7 +443,7 @@ void LLVMDisassembler::readSections() { template void LLVMDisassembler::forEachFunction(std::function callback) { std::for_each(functions.begin(), functions.end(), - [&](std::pair x) { + [&](std::pair x) { callback(x.first, x.second); }); } diff --git a/src/disassembler/llvm/LLVMDisassembler.hxx b/src/disassembler/llvm/LLVMDisassembler.hxx index 2291e20..2713ac6 100644 --- a/src/disassembler/llvm/LLVMDisassembler.hxx +++ b/src/disassembler/llvm/LLVMDisassembler.hxx @@ -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 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 blocks; - std::map functions; + std::map functions; llvm::Triple triple; std::shared_ptr binary; diff --git a/src/disassembler/llvm/LLVMFunction.hxx b/src/disassembler/llvm/LLVMFunction.hxx deleted file mode 100644 index e28b958..0000000 --- a/src/disassembler/llvm/LLVMFunction.hxx +++ /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