Forward-port to LLVM 3.5 release
authorChristoph Egger <christoph@anonymous.siccegge.de>
Wed, 19 Nov 2014 15:46:18 +0000 (16:46 +0100)
committerChristoph Egger <christoph@anonymous.siccegge.de>
Wed, 19 Nov 2014 15:46:18 +0000 (16:46 +0100)
src/disassembler/llvm/LLVMDisassembler.cxx
src/disassembler/llvm/LLVMDisassembler.hxx
src/include_llvm.hxx

index 76b313de3bf996d0d355bc69e9b004c47d476efb..c2b0527f1f33b2a158c8505776d034e6cbad4e20 100644 (file)
@@ -7,6 +7,7 @@
 
 using namespace llvm;
 using namespace llvm::object;
+using std::error_code;
 
 /*
  * TODO: fallback code falls die Datei kein ELF/PE/COFF/MacO/.. binary
@@ -72,22 +73,25 @@ LLVMDisassembler::LLVMDisassembler(const std::string& filename)
         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()));
 
@@ -101,7 +105,7 @@ LLVMDisassembler::LLVMDisassembler(const std::string& filename)
     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));
 
index 52a744346a41cefa10f176597fbe10e3db2a9aa1..6ed3c8c86936b75c383097e3ff841fd0db8ad027 100644 (file)
@@ -63,8 +63,8 @@ private:
     std::unique_ptr<const llvm::MCInstrAnalysis> MIA;
     std::unique_ptr<const llvm::MCSubtargetInfo> STI;
     std::unique_ptr<const llvm::MCInstrInfo> MII;
-       llvm::OwningPtr<llvm::MCRelocationInfo> RelInfo;
-       llvm::OwningPtr<llvm::MCSymbolizer> Symzer;
+    std::unique_ptr<llvm::MCRelocationInfo> RelInfo;
+    std::unique_ptr<llvm::MCSymbolizer> Symzer;
 
     std::map<std::string, llvm::object::SectionRef> sections;
     std::map<std::string, llvm::object::SymbolRef> symbols;
index 41253f5081db8ed08a07f753050434e995d63a15..0ab21a34399bd8c337da3b9a7f31f2acd0233609 100644 (file)
@@ -1,32 +1,33 @@
 #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