Make sure to delete LLVM target machine.

This commit is contained in:
Danila Fedorin 2020-09-09 23:45:48 -07:00
parent d950b8dc90
commit df5f5eba1c

View File

@ -93,9 +93,9 @@ void output_llvm(llvm_context& ctx, const std::string& filename) {
std::string cpu = "generic"; std::string cpu = "generic";
std::string features = ""; std::string features = "";
llvm::TargetOptions options; llvm::TargetOptions options;
llvm::TargetMachine* targetMachine = std::unique_ptr<llvm::TargetMachine> targetMachine(
target->createTargetMachine(targetTriple, cpu, features, target->createTargetMachine(targetTriple, cpu, features,
options, llvm::Optional<llvm::Reloc::Model>()); options, llvm::Optional<llvm::Reloc::Model>()));
ctx.module.setDataLayout(targetMachine->createDataLayout()); ctx.module.setDataLayout(targetMachine->createDataLayout());
ctx.module.setTargetTriple(targetTriple); ctx.module.setTargetTriple(targetTriple);