using namespace llvm;
using namespace llvm::object;
+using std::error_code;
/*
* TODO: fallback code falls die Datei kein ELF/PE/COFF/MacO/.. binary
return;
}
- DisAsm.reset(target->createMCDisassembler(*STI));
+ MOFI.reset(new MCObjectFileInfo);
+ MCContext Ctx(AsmInfo.get(), MRI.get(), MOFI.get());
+
+ DisAsm.reset(target->createMCDisassembler(*STI, Ctx));
if (!DisAsm) {
LOG4CXX_ERROR(logger, "no disassembler for target " << tripleName);
return;
}
-
- MOFI.reset(new MCObjectFileInfo);
- Ctx.reset(new MCContext(AsmInfo.get(), MRI.get(), MOFI.get()));
RelInfo.reset(
- target->createMCRelocationInfo(tripleName, *Ctx.get()));
+ target->createMCRelocationInfo(tripleName, Ctx));
if (RelInfo) {
Symzer.reset(
- MCObjectSymbolizer::createObjectSymbolizer(*Ctx.get(), RelInfo, o));
+ MCObjectSymbolizer::createObjectSymbolizer(Ctx, std::move(RelInfo), o));
if (Symzer)
- DisAsm->setSymbolizer(Symzer);
+ DisAsm->setSymbolizer(std::move(Symzer));
}
+ RelInfo.release();
+ Symzer.release();
+
MIA.reset(target->createMCInstrAnalysis(MII.get()));
IP->setPrintImmHex(llvm::HexStyle::C);
IP->setPrintImmHex(true);
- OwningPtr<MCObjectDisassembler> OD(
+ std::unique_ptr<MCObjectDisassembler> OD(
new MCObjectDisassembler(*o, *DisAsm, *MIA));
Mod.reset(OD->buildModule(false));
#ifndef INCLUDE__include_llvm_hxx
#define INCLUDE__include_llvm_hxx
-#include "llvm/ADT/OwningPtr.h"
-#include "llvm/ADT/Triple.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/StringExtras.h"
-#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/Object/ObjectFile.h"
-#include "llvm/Object/Archive.h"
-#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCAtom.h"
-#include "llvm/MC/MCContext.h"
-#include "llvm/MC/MCDisassembler.h"
-#include "llvm/MC/MCFunction.h"
-#include "llvm/MC/MCInst.h"
-#include "llvm/MC/MCInstPrinter.h"
-#include "llvm/MC/MCInstrAnalysis.h"
-#include "llvm/MC/MCInstrInfo.h"
-#include "llvm/MC/MCModule.h"
-#include "llvm/MC/MCObjectDisassembler.h"
-#include "llvm/MC/MCObjectFileInfo.h"
-#include "llvm/MC/MCObjectSymbolizer.h"
-#include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/MC/MCRelocationInfo.h"
-#include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/Support/TargetRegistry.h"
-#include "llvm/Support/TargetSelect.h"
-#include "llvm/Support/StringRefMemoryObject.h"
-#include "llvm/Support/GraphWriter.h"
+#define LLVM_OVERRIDE override
+
+#include <llvm/ADT/Triple.h>
+#include <llvm/ADT/STLExtras.h>
+#include <llvm/ADT/StringExtras.h>
+#include <llvm/MC/MCAsmInfo.h>
+#include <llvm/Object/ObjectFile.h>
+#include <llvm/Object/Archive.h>
+#include <llvm/MC/MCAsmInfo.h>
+#include <llvm/MC/MCAnalysis/MCAtom.h>
+#include <llvm/MC/MCContext.h>
+#include <llvm/MC/MCDisassembler.h>
+#include <llvm/MC/MCAnalysis/MCFunction.h>
+#include <llvm/MC/MCInst.h>
+#include <llvm/MC/MCInstPrinter.h>
+#include <llvm/MC/MCInstrAnalysis.h>
+#include <llvm/MC/MCInstrInfo.h>
+#include <llvm/MC/MCAnalysis/MCModule.h>
+#include <llvm/MC/MCObjectDisassembler.h>
+#include <llvm/MC/MCObjectFileInfo.h>
+#include <llvm/MC/MCObjectSymbolizer.h>
+#include <llvm/MC/MCRegisterInfo.h>
+#include <llvm/MC/MCRelocationInfo.h>
+#include <llvm/MC/MCSubtargetInfo.h>
+#include <llvm/Support/TargetRegistry.h>
+#include <llvm/Support/TargetSelect.h>
+#include <llvm/Support/StringRefMemoryObject.h>
+#include <llvm/Support/GraphWriter.h>
#endif