Add compile-time flag to disable output.
This commit is contained in:
parent
dbabec0db6
commit
72d8179cc5
|
@ -58,11 +58,13 @@ void typecheck_program(
|
||||||
defs.find_free(free);
|
defs.find_free(free);
|
||||||
defs.typecheck(mgr, env);
|
defs.typecheck(mgr, env);
|
||||||
|
|
||||||
|
#ifdef DEBUG_OUT
|
||||||
for(auto& pair : defs.env->names) {
|
for(auto& pair : defs.env->names) {
|
||||||
std::cout << pair.first << ": ";
|
std::cout << pair.first << ": ";
|
||||||
pair.second.type->print(mgr, std::cout);
|
pair.second.type->print(mgr, std::cout);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
global_scope translate_program(definition_group& group) {
|
global_scope translate_program(definition_group& group) {
|
||||||
|
@ -160,7 +162,10 @@ void gen_llvm(global_scope& scope) {
|
||||||
|
|
||||||
scope.generate_llvm(ctx);
|
scope.generate_llvm(ctx);
|
||||||
|
|
||||||
|
#ifdef DEBUG_OUT
|
||||||
ctx.module.print(llvm::outs(), nullptr);
|
ctx.module.print(llvm::outs(), nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
output_llvm(ctx, "program.o");
|
output_llvm(ctx, "program.o");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +182,7 @@ int main(int argc, char** argv) {
|
||||||
type_mgr mgr;
|
type_mgr mgr;
|
||||||
type_env_ptr env(new type_env);
|
type_env_ptr env(new type_env);
|
||||||
|
|
||||||
|
#ifdef DEBUG_OUT
|
||||||
for(auto& def_defn : driver.global_defs.defs_defn) {
|
for(auto& def_defn : driver.global_defs.defs_defn) {
|
||||||
std::cout << def_defn.second->name;
|
std::cout << def_defn.second->name;
|
||||||
for(auto& param : def_defn.second->params) std::cout << " " << param;
|
for(auto& param : def_defn.second->params) std::cout << " " << param;
|
||||||
|
@ -185,6 +191,8 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
try {
|
try {
|
||||||
typecheck_program(driver.global_defs, mgr, env);
|
typecheck_program(driver.global_defs, mgr, env);
|
||||||
global_scope scope = translate_program(driver.global_defs);
|
global_scope scope = translate_program(driver.global_defs);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user