Add basic parser support for operands:
- This introduces a new FunctionParser base class to handle logic common
between the kinds of functions we have, e.g. ssa operand/def parsing.
- This introduces a basic symbol table (without support for forward
references!) and links defs and uses.
- CFG functions now parse and build operand lists for operations. The printer
isn't set up for them yet tho.
PiperOrigin-RevId: 205246110
diff --git a/test/IR/parser-errors.mlir b/test/IR/parser-errors.mlir
index 98f4aaf..4f67c8e 100644
--- a/test/IR/parser-errors.mlir
+++ b/test/IR/parser-errors.mlir
@@ -153,3 +153,19 @@
#map = (d0) -> (% // expected-error {{invalid SSA name}}
// -----
+
+cfgfunc @test() {
+bb40:
+ %1 = "foo"() : (i32)->i64 // expected-error {{expected 0 types in operand list but had 1}}
+ return
+}
+
+
+// -----
+
+cfgfunc @redef() {
+bb42:
+ %x = "dim"(){index: 0} : ()->i32
+ %x = "dim"(){index: 0} : ()->i32 // expected-error {{redefinition of SSA value %x}}
+ return
+}
\ No newline at end of file