Slightly improved error reporting for << and >>.

This commit is contained in:
Stefano Sanfilippo 2015-03-10 20:54:04 +01:00
parent d10d8cf3fd
commit 47302ea0de

View File

@ -683,9 +683,9 @@ bool BitcodeEmitter::emit(Float const& node) {
d->retval = d->builder.Create##intop(left, right); \ d->retval = d->builder.Create##intop(left, right); \
} }
#define HANDLE_INT_ONLY(op) \ #define HANDLE_INT_ONLY(op, symbol) \
if (fp) { \ if (fp) { \
return reportError({"Operator cannot be applied to float values!"}); \ return reportError({"Operator " #symbol " cannot be applied to float values!"}); \
} else { \ } else { \
d->retval = d->builder.Create##op(left, right); \ d->retval = d->builder.Create##op(left, right); \
} }
@ -721,10 +721,10 @@ bool createOp(BitcodeEmitter::Private *d, llvm::Value *left, Operator op, llvm::
HANDLE(SDiv, FDiv) HANDLE(SDiv, FDiv)
break; break;
case Operator::SHL: case Operator::SHL:
HANDLE_INT_ONLY(Shl); HANDLE_INT_ONLY(Shl, <<);
break; break;
case Operator::SHR: case Operator::SHR:
HANDLE_INT_ONLY(LShr); HANDLE_INT_ONLY(LShr, >>);
break; break;
case Operator::LT: case Operator::LT:
HANDLE(ICmpULT, FCmpULT) HANDLE(ICmpULT, FCmpULT)