diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 09:35:19 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 09:35:19 +0000 |
| commit | 6b332f91c82da6e19efad92b58ac1d9c1bc9eec0 (patch) | |
| tree | a553b6aab0589dd7cafe5b2508cb274ac0ae9e98 /lib/CodeGen/CodeGen.cc | |
| parent | b25cbba212354e44921d23490765782f61787bc8 (diff) | |
feat(runtime): write runtime diagnostics to stderr
Runtime check messages and the unhandled-exception message were printed
to stdout by the generated program, so `cpsc x.cps -r >out.txt` captured
them. They are now formatted with snprintf and written with write(2).
Test expectations and docs are updated accordingly.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/CodeGen.cc')
| -rw-r--r-- | lib/CodeGen/CodeGen.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/CodeGen/CodeGen.cc b/lib/CodeGen/CodeGen.cc index eba7d77..b81fe2b 100644 --- a/lib/CodeGen/CodeGen.cc +++ b/lib/CodeGen/CodeGen.cc @@ -340,7 +340,7 @@ void CodeGen::compile(const std::vector<SourceUnit> &Sources) { Exceptions->endCatch(); Value *Msg = Builder->CreateGlobalString("Unhandled exception. Program terminated.\n", "err_unhandled", 0, TheModule.get()); - Builder->CreateCall(PrintfFunc, {Msg}); + RuntimeChecker->emitStderr(Msg); Builder->CreateRet(ConstantInt::get(Type::getInt32Ty(*TheContext), 1)); if (verifyModule(*TheModule, &errs())) { |
