[Mlir-commits] [mlir] 2ba8659 - [mlir][emitc] Add test for invalid type
Marius Brehler
llvmlistbot at llvm.org
Tue Apr 19 02:04:50 PDT 2022
Author: Marius Brehler
Date: 2022-04-19T11:03:56+02:00
New Revision: 2ba865903daed7b4dff0d4afb2410614325a19fe
URL: https://github.com/llvm/llvm-project/commit/2ba865903daed7b4dff0d4afb2410614325a19fe
DIFF: https://github.com/llvm/llvm-project/commit/2ba865903daed7b4dff0d4afb2410614325a19fe.diff
LOG: [mlir][emitc] Add test for invalid type
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D123503
Added:
mlir/test/Dialect/EmitC/invalid_types.mlir
Modified:
mlir/lib/Dialect/EmitC/IR/EmitC.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
index 06e5a6b536417..e89b68116dc76 100644
--- a/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
+++ b/mlir/lib/Dialect/EmitC/IR/EmitC.cpp
@@ -217,7 +217,7 @@ Type emitc::OpaqueType::parse(AsmParser &parser) {
std::string value;
SMLoc loc = parser.getCurrentLocation();
if (parser.parseOptionalString(&value) || value.empty()) {
- parser.emitError(loc) << "expected non empty string";
+ parser.emitError(loc) << "expected non empty string in !emitc.opaque type";
return Type();
}
if (parser.parseGreater())
diff --git a/mlir/test/Dialect/EmitC/invalid_types.mlir b/mlir/test/Dialect/EmitC/invalid_types.mlir
new file mode 100644
index 0000000000000..5e05b56fa5e83
--- /dev/null
+++ b/mlir/test/Dialect/EmitC/invalid_types.mlir
@@ -0,0 +1,6 @@
+// RUN: mlir-opt %s -split-input-file -verify-diagnostics
+
+func @illegal_opaque_type_1() {
+ // expected-error @+1 {{expected non empty string in !emitc.opaque type}}
+ %1 = "emitc.variable"(){value = "42" : !emitc.opaque<"">} : () -> !emitc.opaque<"mytype">
+}
More information about the Mlir-commits
mailing list