summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-11-07 01:09:51 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-11-07 01:09:51 +0000
commit1d7d4eb15c4ce6ded6f88a2e5a94e8db7de20ecb (patch)
tree5b2e8423d7739db1b4881b959d951a8cd675cc62 /llvm/lib
parentbd604f270a829db3da7e3185d03f8cc11bf67a0b (diff)
downloadbcm5719-llvm-1d7d4eb15c4ce6ded6f88a2e5a94e8db7de20ecb.tar.gz
bcm5719-llvm-1d7d4eb15c4ce6ded6f88a2e5a94e8db7de20ecb.zip
Use a StringRefMemoryObject. NFC.
llvm-svn: 221503
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCDisassembler/Disassembler.cpp29
1 files changed, 3 insertions, 26 deletions
diff --git a/llvm/lib/MC/MCDisassembler/Disassembler.cpp b/llvm/lib/MC/MCDisassembler/Disassembler.cpp
index 321b1c173a5..22095313f1c 100644
--- a/llvm/lib/MC/MCDisassembler/Disassembler.cpp
+++ b/llvm/lib/MC/MCDisassembler/Disassembler.cpp
@@ -21,7 +21,7 @@
#include "llvm/MC/MCSymbolizer.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
-#include "llvm/Support/MemoryObject.h"
+#include "llvm/Support/StringRefMemoryObject.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
@@ -122,30 +122,6 @@ void LLVMDisasmDispose(LLVMDisasmContextRef DCR){
delete DC;
}
-namespace {
-//
-// The memory object created by LLVMDisasmInstruction().
-//
-class DisasmMemoryObject : public MemoryObject {
- uint8_t *Bytes;
- uint64_t Size;
- uint64_t BasePC;
-public:
- DisasmMemoryObject(uint8_t *bytes, uint64_t size, uint64_t basePC) :
- Bytes(bytes), Size(size), BasePC(basePC) {}
-
- uint64_t getBase() const override { return BasePC; }
- uint64_t getExtent() const override { return Size; }
-
- int readByte(uint64_t Addr, uint8_t *Byte) const override {
- if (Addr - BasePC >= Size)
- return -1;
- *Byte = Bytes[Addr - BasePC];
- return 0;
- }
-};
-} // end anonymous namespace
-
/// \brief Emits the comments that are stored in \p DC comment stream.
/// Each comment in the comment stream must end with a newline.
static void emitComments(LLVMDisasmContext *DC,
@@ -269,7 +245,8 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DCR, uint8_t *Bytes,
size_t OutStringSize){
LLVMDisasmContext *DC = (LLVMDisasmContext *)DCR;
// Wrap the pointer to the Bytes, BytesSize and PC in a MemoryObject.
- DisasmMemoryObject MemoryObject(Bytes, BytesSize, PC);
+ StringRef Data((const char*) Bytes, BytesSize);
+ StringRefMemoryObject MemoryObject(Data, PC);
uint64_t Size;
MCInst Inst;
OpenPOWER on IntegriCloud