const auto &results = function.getType().getResults();
if (op.getNumOperands() != results.size())
return op.emitOpError("has ")
- << op.getNumOperands()
- << " operands, but enclosing function returns " << results.size();
+ << op.getNumOperands() << " operands, but enclosing function (@"
+ << function.getName() << ") returns " << results.size();
for (unsigned i = 0, e = results.size(); i != e; ++i)
if (op.getOperand(i).getType() != results[i])
return op.emitError()
<< "type of return operand " << i << " ("
<< op.getOperand(i).getType()
- << ") doesn't match function result type (" << results[i] << ")";
+ << ") doesn't match function result type (" << results[i] << ")"
+ << " in function @" << function.getName();
return success();
}
func @resulterror() -> i32 {
^bb42:
- return // expected-error {{'std.return' op has 0 operands, but enclosing function returns 1}}
+ return // expected-error {{'std.return' op has 0 operands, but enclosing function (@resulterror) returns 1}}
}
// -----
func @func_resulterror() -> i32 {
- return // expected-error {{'std.return' op has 0 operands, but enclosing function returns 1}}
+ return // expected-error {{'std.return' op has 0 operands, but enclosing function (@func_resulterror) returns 1}}
}
// -----
func @return_type_mismatch() -> i32 {
%0 = "foo"() : ()->f32
- return %0 : f32 // expected-error {{type of return operand 0 ('f32') doesn't match function result type ('i32')}}
+ return %0 : f32 // expected-error {{type of return operand 0 ('f32') doesn't match function result type ('i32') in function @return_type_mismatch}}
}
// -----