diff options
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
| -rw-r--r-- | src/rustllvm/RustWrapper.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 2a3d8aeb79e..2c50a6ccfa7 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -90,7 +90,7 @@ extern "C" void LLVMRustWriteOutputFile(LLVMPassManagerRef PMR, std::string Err; const Target *TheTarget = TargetRegistry::lookupTarget(triple, Err); std::string FeaturesStr; - TargetMachine &Target = *TheTarget->createTargetMachine(triple, FeaturesStr); + TargetMachine *Target = TheTarget->createTargetMachine(triple, FeaturesStr); bool NoVerify = false; CodeGenOpt::Level OLvl = CodeGenOpt::Default; PassManager *PM = unwrap<PassManager>(PMR); @@ -101,10 +101,11 @@ extern "C" void LLVMRustWriteOutputFile(LLVMPassManagerRef PMR, TargetMachine::CodeGenFileType FileType2 = static_cast<TargetMachine::CodeGenFileType>(FileType); - bool foo = Target.addPassesToEmitFile(*PM, FOS, FileType2, OLvl, NoVerify); + bool foo = Target->addPassesToEmitFile(*PM, FOS, FileType2, OLvl, NoVerify); assert(!foo); (void)foo; PM->run(*unwrap(M)); + delete Target; } extern "C" LLVMModuleRef LLVMRustParseBitcode(LLVMMemoryBufferRef MemBuf) { |
