Skip to content

Commit a41787f

Browse files
committed
Improve error when function return type was expected to be void
1 parent f8b460d commit a41787f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,10 @@ LogicalResult ModuleTranslation::convertOperation(Operation &opInst,
337337
return success();
338338
}
339339
// Check that LLVM call returns void for 0-result functions.
340-
return success(result->getType()->isVoidTy());
340+
if (!result->getType()->isVoidTy()) {
341+
return opInst.emitError("expected callee to return void");
342+
}
343+
return success();
341344
}
342345

343346
if (auto invOp = dyn_cast<LLVM::InvokeOp>(opInst)) {

0 commit comments

Comments
 (0)