aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-07-08 21:29:34 +0200
committerThomas Voss <mail@thomasvoss.com> 2024-07-08 21:29:34 +0200
commita6669c94e68149414c6dbe2bd0d7427f02cdb043 (patch)
treeff11b148ce6d6b666b7e091bcdd7f01f2fbf21bc
parentbf55e73560fae478c7440fab858c48884938b9fa (diff)
Print to stdout when -l is provided
-rw-r--r--src/codegen.c8
1 files changed, 5 insertions, 3 deletions
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;