diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-21 14:03:31 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-21 14:03:31 +0000 |
| commit | b4ffb2d9498560557821714e2d4651279dd6817c (patch) | |
| tree | 995ad02bdb8cc461f48a53683c4fd7f2ddd8656b /lib/CodeGen/FunctionGen.cc | |
| parent | f1f5fa394a67a789914ccf2b24d534a0e466ae1b (diff) | |
feat(diagnostics): print source diagnostics in gcc file:line: layout
Lexer, parser, driver and codegen diagnostics now read
"<path>:<line>: error: <message>" instead of "error: <message> at line N
in <path>". The path is always printed as given on the command line.
Call sites pass the bare message to cps::sourceError/sourceWarning, which
carry printf format checking; reportError routes through the same helper.
The suite iii harness parses the new layout and matches the reason
against the message only. iii/template-class-pack-field passed only
because its reason regex matched the case path, so it is now
case-insensitive.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
| -rw-r--r-- | lib/CodeGen/FunctionGen.cc | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc index c01b042..628f3ba 100644 --- a/lib/CodeGen/FunctionGen.cc +++ b/lib/CodeGen/FunctionGen.cc @@ -30,10 +30,7 @@ bool FunctionGen::isReservedRuntimeName(const std::string &Name) { void FunctionGen::reportError(const char *Fmt, ...) { va_list Args; va_start(Args, Fmt); - fprintf(stderr, "error: "); - vfprintf(stderr, Fmt, Args); - if (DiagnosticLine) fprintf(stderr, "%s", lineSuffix(DiagnosticLine).c_str()); - fprintf(stderr, "\n"); + cps::vsourceDiagnostic(cps::Severity::Error, DiagnosticLine, Fmt, Args); va_end(Args); HadError = true; } @@ -449,7 +446,7 @@ static Value *GenerateCall(llvm::Module &Module, bool &HadError, int DiagnosticLine) { Function *CalleeF = Module.getFunction(CalleeName); if (!CalleeF) { - sourceDiagnostic(DiagnosticLine, "error: Call to undefined function %s\n", CalleeName.c_str()); + sourceError(DiagnosticLine, "Call to undefined function %s", CalleeName.c_str()); HadError = true; return nullptr; } |
