aboutsummaryrefslogtreecommitdiffstats
path: root/llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm.cpp')
-rw-r--r--llvm.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm.cpp b/llvm.cpp
index e94a806..8eeab42 100644
--- a/llvm.cpp
+++ b/llvm.cpp
@@ -92,8 +92,8 @@ struct CEnvPimpl {
Function* alloc;
};
-CEnv::CEnv(PEnv& p, TEnv& t, CEngine& eng)
- : engine(eng), penv(p), tenv(t), symID(0), _pimpl(new CEnvPimpl(eng))
+CEnv::CEnv(PEnv& p, TEnv& t, CEngine& e, ostream& os, ostream& es)
+ : engine(e), penv(p), tenv(t), symID(0), alloc(0), log(os, es), _pimpl(new CEnvPimpl(e))
{
}
@@ -539,10 +539,10 @@ eval(CEnv& cenv, const string& name, istream& is)
cenv.engine.builder.CreateRet(val);
cenv.optimise(f);
- out << call(resultType, cenv.engine.engine->getPointerToFunction(f))
+ cenv.log.out << call(resultType, cenv.engine.engine->getPointerToFunction(f))
<< " : " << resultType->str() << endl;
} catch (Error& e) {
- err << e.what() << endl;
+ cenv.log.err << e.what() << endl;
return 1;
}
return 0;
@@ -552,8 +552,8 @@ int
repl(CEnv& cenv)
{
while (1) {
- out << "() ";
- out.flush();
+ cenv.log.out << "() ";
+ cenv.log.out.flush();
Cursor cursor("(stdin)");
try {
SExp exp = readExpression(cursor, std::cin);
@@ -580,13 +580,13 @@ repl(CEnv& cenv)
f->eraseFromParent(); // Error reading body, remove function
throw e;
}
- out << call(bodyT, cenv.engine.engine->getPointerToFunction(f));
+ cenv.log.out << call(bodyT, cenv.engine.engine->getPointerToFunction(f));
} else {
- out << "; " << cenv.compile(body);
+ cenv.log.out << "; " << cenv.compile(body);
}
- out << " : " << cenv.tenv.type(body)->str() << endl;
+ cenv.log.out << " : " << cenv.tenv.type(body)->str() << endl;
} catch (Error& e) {
- err << e.what() << endl;
+ cenv.log.err << e.what() << endl;
}
}
return 0;