From a6669c94e68149414c6dbe2bd0d7427f02cdb043 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 8 Jul 2024 21:29:34 +0200 Subject: Print to stdout when -l is provided --- src/codegen.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/codegen.c b/src/codegen.c index 35e19f9..2ec3be7 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -109,10 +109,12 @@ codegen(const char *file, bitset_t *cnst, fold_t *folds, scope_t *scps, err("codegen: %s", error); if (lflag) { - if (oflag == NULL) - LLVMDumpModule(ctx.mod); - else if (LLVMPrintModuleToFile(llmod, oflag, &error) == 1) + if (LLVMPrintModuleToFile(llmod, oflag == NULL ? "/dev/stdout" : oflag, + &error) + == 1) + { err("codegen: %s", error); + } } else { LLVMCodeGenFileType ft; const char *dst = oflag == NULL ? "out.o" : oflag; -- cgit v1.2.3