Add support for operands to the return instructions, enhance verifier to report errors through the diagnostics system when invoked by the parser. It doesn't have perfect location info, but it is close enough to be testable.
PiperOrigin-RevId: 205534392
diff --git a/include/mlir/IR/Builders.h b/include/mlir/IR/Builders.h
index 1da2312..1a003b6 100644
--- a/include/mlir/IR/Builders.h
+++ b/include/mlir/IR/Builders.h
@@ -134,10 +134,12 @@
// Terminators.
- ReturnInst *createReturnInst() { return insertTerminator(new ReturnInst()); }
+ ReturnInst *createReturnInst(ArrayRef<CFGValue *> operands) {
+ return insertTerminator(ReturnInst::create(operands));
+ }
BranchInst *createBranchInst(BasicBlock *dest) {
- return insertTerminator(new BranchInst(dest));
+ return insertTerminator(BranchInst::create(dest));
}
private: