Browse Source

Add compile-time flag to disable output.

search
Danila Fedorin 1 year ago
parent
commit
72d8179cc5
  1. 8
      code/compiler/13/main.cpp

8
code/compiler/13/main.cpp

@ -58,11 +58,13 @@ void typecheck_program(
defs.find_free(free);
defs.typecheck(mgr, env);
#ifdef DEBUG_OUT
for(auto& pair : defs.env->names) {
std::cout << pair.first << ": ";
pair.second.type->print(mgr, std::cout);
std::cout << std::endl;
}
#endif
}
global_scope translate_program(definition_group& group) {
@ -160,7 +162,10 @@ void gen_llvm(global_scope& scope) {
scope.generate_llvm(ctx);
#ifdef DEBUG_OUT
ctx.module.print(llvm::outs(), nullptr);
#endif
output_llvm(ctx, "program.o");
}
@ -177,6 +182,7 @@ int main(int argc, char** argv) {
type_mgr mgr;
type_env_ptr env(new type_env);
#ifdef DEBUG_OUT
for(auto& def_defn : driver.global_defs.defs_defn) {
std::cout << def_defn.second->name;
for(auto& param : def_defn.second->params) std::cout << " " << param;
@ -185,6 +191,8 @@ int main(int argc, char** argv) {
std::cout << std::endl;
}
#endif
try {
typecheck_program(driver.global_defs, mgr, env);
global_scope scope = translate_program(driver.global_defs);

Loading…
Cancel
Save