aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/Examples
diff options
context:
space:
mode:
authorMatthias Kramm <kramm@google.com>2020-03-03 13:20:48 -0800
committerRiver Riddle <riddleriver@gmail.com>2020-03-03 13:21:05 -0800
commitcb530ec8b841b8033032a8bf88d93f7d6df2dbe0 (patch)
tree95aa5d1bfeca85af40a4ff6455a7a01ac42a388c /mlir/test/Examples
parentc10896682d0bb457b9d77fdd753ed9e7e6806db1 (diff)
downloadllvm-cb530ec8b841b8033032a8bf88d93f7d6df2dbe0.zip
llvm-cb530ec8b841b8033032a8bf88d93f7d6df2dbe0.tar.gz
llvm-cb530ec8b841b8033032a8bf88d93f7d6df2dbe0.tar.bz2
[mlir][Tutorial] Make parsing an empty file print a better error.
Summary: Previously, we would, for an empty file, print the somewhat confusing Assertion `tok == curTok [...]' failed. With this change, we now print Parse error [...]: expected 'def' [...] This only affects the parser from chapters 1-6, since the more advanced chapter 7 parser is actually able to generate an empty module from an empty file. Nonetheless, this commit also adds the additional check to the chapter 7 parser, for consistency. Differential Revision: https://reviews.llvm.org/D75534
Diffstat (limited to 'mlir/test/Examples')
-rw-r--r--mlir/test/Examples/Toy/Ch1/empty.toy3
-rw-r--r--mlir/test/Examples/Toy/Ch2/empty.toy3
-rw-r--r--mlir/test/Examples/Toy/Ch3/empty.toy3
-rw-r--r--mlir/test/Examples/Toy/Ch4/empty.toy3
-rw-r--r--mlir/test/Examples/Toy/Ch5/empty.toy3
-rw-r--r--mlir/test/Examples/Toy/Ch6/empty.toy3
-rw-r--r--mlir/test/Examples/Toy/Ch7/empty.toy4
7 files changed, 22 insertions, 0 deletions
diff --git a/mlir/test/Examples/Toy/Ch1/empty.toy b/mlir/test/Examples/Toy/Ch1/empty.toy
new file mode 100644
index 0000000..1e1e83a
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch1/empty.toy
@@ -0,0 +1,3 @@
+# RUN: toyc-ch1 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK: Parse error
diff --git a/mlir/test/Examples/Toy/Ch2/empty.toy b/mlir/test/Examples/Toy/Ch2/empty.toy
new file mode 100644
index 0000000..36d092e
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch2/empty.toy
@@ -0,0 +1,3 @@
+# RUN: toyc-ch2 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK: Parse error
diff --git a/mlir/test/Examples/Toy/Ch3/empty.toy b/mlir/test/Examples/Toy/Ch3/empty.toy
new file mode 100644
index 0000000..87baab2
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch3/empty.toy
@@ -0,0 +1,3 @@
+# RUN: toyc-ch3 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK: Parse error
diff --git a/mlir/test/Examples/Toy/Ch4/empty.toy b/mlir/test/Examples/Toy/Ch4/empty.toy
new file mode 100644
index 0000000..5ad37f7
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch4/empty.toy
@@ -0,0 +1,3 @@
+# RUN: toyc-ch4 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK: Parse error
diff --git a/mlir/test/Examples/Toy/Ch5/empty.toy b/mlir/test/Examples/Toy/Ch5/empty.toy
new file mode 100644
index 0000000..d43f34e
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch5/empty.toy
@@ -0,0 +1,3 @@
+# RUN: toyc-ch5 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK: Parse error
diff --git a/mlir/test/Examples/Toy/Ch6/empty.toy b/mlir/test/Examples/Toy/Ch6/empty.toy
new file mode 100644
index 0000000..f221f38
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch6/empty.toy
@@ -0,0 +1,3 @@
+# RUN: toyc-ch6 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK: Parse error
diff --git a/mlir/test/Examples/Toy/Ch7/empty.toy b/mlir/test/Examples/Toy/Ch7/empty.toy
new file mode 100644
index 0000000..d9d4b8e
--- /dev/null
+++ b/mlir/test/Examples/Toy/Ch7/empty.toy
@@ -0,0 +1,4 @@
+# RUN: toyc-ch7 %s -emit=ast 2>&1 | FileCheck %s
+# CHECK-NOT: Assert
+# CHECK-NOT: Parse error
+# CHECK: Module