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/ArithmeticHandler.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/ArithmeticHandler.cc')
| -rw-r--r-- | lib/CodeGen/ArithmeticHandler.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/ArithmeticHandler.cc b/lib/CodeGen/ArithmeticHandler.cc index cd4e7b3..255da57 100644 --- a/lib/CodeGen/ArithmeticHandler.cc +++ b/lib/CodeGen/ArithmeticHandler.cc @@ -1,3 +1,4 @@ +#include "cps/Diagnostics.h" #include "cps/ArithmeticHandler.h" #include "cps/Lexer.h" #include "cps/RuntimeCheck.h" @@ -28,7 +29,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) if (LVal->getType()->isIntegerTy(64)) LVal = Builder.CreateSIToFP(LVal, Type::getDoubleTy(Context)); if (RVal->getType()->isIntegerTy(64)) RVal = Builder.CreateSIToFP(RVal, Type::getDoubleTy(Context)); if (!LVal->getType()->isDoubleTy() || !RVal->getType()->isDoubleTy()) { - fprintf(stderr, "error: '/' requires numeric operands (line %d).\n", Line); + cps::sourceDiagnostic(Line, "error: '/' requires numeric operands (line %d).\n", Line); HadError = true; return nullptr; } @@ -39,7 +40,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) if (Op == tok_div || Op == tok_mod) { if (!LIsInt || !RIsInt) { - fprintf(stderr, "error: DIV and MOD operators require INTEGER operands (line %d).\n", Line); + cps::sourceDiagnostic(Line, "error: DIV and MOD operators require INTEGER operands (line %d).\n", Line); HadError = true; return nullptr; } @@ -96,7 +97,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) R = widenSmallInt(Builder, Context, R); } if (L->getType() != R->getType()) { - fprintf(stderr, "error: Mismatched operand types for binary operator (line %d).\n", Line); + cps::sourceDiagnostic(Line, "error: Mismatched operand types for binary operator (line %d).\n", Line); HadError = true; return nullptr; } @@ -114,7 +115,7 @@ Value *ArithmeticHandler::emitBinaryOp(int Op, Value *LHS, Value *RHS, int Line) } } - fprintf(stderr, "error: Unsupported operand types for binary operator (line %d).\n", Line); + cps::sourceDiagnostic(Line, "error: Unsupported operand types for binary operator (line %d).\n", Line); HadError = true; return nullptr; } |
