mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Make it explicit that ExecutionEngine takes ownership of the modules.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215967 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -125,13 +125,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
//Read the BrainF program
|
||||
BrainF bf;
|
||||
Module *mod = bf.parse(in, 65536, cf, Context); //64 KiB
|
||||
std::unique_ptr<Module> Mod(bf.parse(in, 65536, cf, Context)); // 64 KiB
|
||||
if (in != &std::cin)
|
||||
delete in;
|
||||
addMainFunction(mod);
|
||||
addMainFunction(Mod.get());
|
||||
|
||||
//Verify generated code
|
||||
if (verifyModule(*mod)) {
|
||||
if (verifyModule(*Mod)) {
|
||||
errs() << "Error: module failed verification. This shouldn't happen.\n";
|
||||
abort();
|
||||
}
|
||||
@@ -141,18 +141,18 @@ int main(int argc, char **argv) {
|
||||
InitializeNativeTarget();
|
||||
|
||||
outs() << "------- Running JIT -------\n";
|
||||
ExecutionEngine *ee = EngineBuilder(mod).create();
|
||||
Module &M = *Mod;
|
||||
ExecutionEngine *ee = EngineBuilder(std::move(Mod)).create();
|
||||
std::vector<GenericValue> args;
|
||||
Function *brainf_func = mod->getFunction("brainf");
|
||||
Function *brainf_func = M.getFunction("brainf");
|
||||
GenericValue gv = ee->runFunction(brainf_func, args);
|
||||
} else {
|
||||
WriteBitcodeToFile(mod, *out);
|
||||
WriteBitcodeToFile(Mod.get(), *out);
|
||||
}
|
||||
|
||||
//Clean up
|
||||
if (out != &outs())
|
||||
delete out;
|
||||
delete mod;
|
||||
|
||||
llvm_shutdown();
|
||||
|
||||
|
Reference in New Issue
Block a user