diff options
| author | _ov4 <ov4@ov4.org> | 2026-10-17 09:09:03 +0000 |
|---|---|---|
| committer | _ov4 <ov4@ov4.org> | 2026-10-17 09:09:03 +0000 |
| commit | dc645a36aaade7087ade574cefe69ce7bb29753e (patch) | |
| tree | d10a4f3ab8947c014f79b940d4658e9ff9730e9d /lib/CodeGen/FunctionGen.cc | |
| parent | 5097edca0619007eb4237e52fcc07f0e0b4b99e2 (diff) | |
refactor(diag): file-qualified diagnostic locations
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'lib/CodeGen/FunctionGen.cc')
| -rw-r--r-- | lib/CodeGen/FunctionGen.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/FunctionGen.cc b/lib/CodeGen/FunctionGen.cc index 59e9bbe..b66b55a 100644 --- a/lib/CodeGen/FunctionGen.cc +++ b/lib/CodeGen/FunctionGen.cc @@ -1,3 +1,4 @@ +#include "cps/Diagnostics.h" #include "cps/FunctionGen.h" #include "cps/CodeGen.h" #include "cps/ExceptionHandler.h" @@ -30,7 +31,7 @@ void FunctionGen::reportError(const char *Fmt, ...) { va_start(Args, Fmt); fprintf(stderr, "error: "); vfprintf(stderr, Fmt, Args); - if (DiagnosticLine) fprintf(stderr, " at line %d", DiagnosticLine); + if (DiagnosticLine) fprintf(stderr, "%s", lineSuffix(DiagnosticLine).c_str()); fprintf(stderr, "\n"); va_end(Args); HadError = true; @@ -258,10 +259,10 @@ static Value *GenerateCall(llvm::Module &Module, ExceptionHandler &Exceptions, const std::string &CalleeName, const std::vector<llvm::Value*> &Args, - bool &HadError) { + bool &HadError, int DiagnosticLine) { Function *CalleeF = Module.getFunction(CalleeName); if (!CalleeF) { - fprintf(stderr, "error: Call to undefined function %s\n", CalleeName.c_str()); + sourceDiagnostic(DiagnosticLine, "error: Call to undefined function %s\n", CalleeName.c_str()); HadError = true; return nullptr; } @@ -275,7 +276,7 @@ static Value *GenerateCall(llvm::Module &Module, llvm::Value *FunctionGen::emitCall(const std::string &Callee, const std::vector<llvm::Value*> &Args) { const FuncSig *Sig = getSignature(Callee); - return GenerateCall(Module, Exceptions, Sig ? Sig->Name : Callee, Args, HadError); + return GenerateCall(Module, Exceptions, Sig ? Sig->Name : Callee, Args, HadError, DiagnosticLine); } void FunctionGen::emitReturn(ReturnStmtAST *Ret, llvm::Value *RetVal) { |
