[PATCH] IntelJITEventListener updates to fix breaks by recent changes to EngineBuilder and DIContext

Arch D. Robison arch.robison at intel.com
Wed Aug 20 14:54:45 PDT 2014


Updated per Rafael Ávila de Espíndola's comments to use std::unique_ptr more naturally.

http://reviews.llvm.org/D4975

Files:
  lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
  tools/llvm-jitlistener/llvm-jitlistener.cpp
  unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h

Index: tools/llvm-jitlistener/llvm-jitlistener.cpp
===================================================================
--- tools/llvm-jitlistener/llvm-jitlistener.cpp
+++ tools/llvm-jitlistener/llvm-jitlistener.cpp
@@ -113,7 +113,7 @@
 
     // Parse the bitcode...
     SMDiagnostic Err;
-    TheModule = ParseIRFile(IRFile, Err, Context);
+    std::unique_ptr<Module> TheModule(ParseIRFile(IRFile, Err, Context));
     if (!TheModule) {
       errs() << Err.getMessage();
       return;
@@ -145,7 +145,7 @@
 
     // Compile the IR
     std::string Error;
-    TheJIT.reset(EngineBuilder(TheModule)
+    TheJIT.reset(EngineBuilder(std::move(TheModule))
       .setEngineKind(EngineKind::JIT)
       .setErrorStr(&Error)
       .setJITMemoryManager(MemMgr)
@@ -160,7 +160,6 @@
   }
 
   LLVMContext Context; // Global ownership
-  Module *TheModule; // Owned by ExecutionEngine.
   JITMemoryManager *JMM; // Owned by ExecutionEngine.
   std::unique_ptr<ExecutionEngine> TheJIT;
 
Index: unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h
===================================================================
--- unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h
+++ unittests/ExecutionEngine/JIT/JITEventListenerTestCommon.h
@@ -66,7 +66,7 @@
   JITEventListenerTestBase(WrapperT* w)
   : MockWrapper(w)
   , M(new llvm::Module("module", llvm::getGlobalContext()))
-  , EE(llvm::EngineBuilder(M)
+  , EE(llvm::EngineBuilder(std::unique_ptr<llvm::Module>(M))
     .setEngineKind(llvm::EngineKind::JIT)
     .setOptLevel(llvm::CodeGenOpt::None)
     .create())
Index: lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
===================================================================
--- lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
+++ lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
@@ -190,7 +190,7 @@
 void IntelJITEventListener::NotifyObjectEmitted(const ObjectImage &Obj) {
   // Get the address of the object image for use as a unique identifier
   const void* ObjData = Obj.getData().data();
-  DIContext* Context = DIContext::getDWARFContext(Obj.getObjectFile());
+  DIContext* Context = DIContext::getDWARFContext(*Obj.getObjectFile());
   MethodAddressVector Functions;
 
   // Use symbol info to iterate functions in the object.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4975.12714.patch
Type: text/x-patch
Size: 2297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140820/15eab358/attachment.bin>


More information about the llvm-commits mailing list