summaryrefslogtreecommitdiff
path: root/mlir/test/python/lib/PythonTestCAPI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/test/python/lib/PythonTestCAPI.cpp')
-rw-r--r--mlir/test/python/lib/PythonTestCAPI.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/mlir/test/python/lib/PythonTestCAPI.cpp b/mlir/test/python/lib/PythonTestCAPI.cpp
index cb7d7677714f..ee6a5ae2d9c3 100644
--- a/mlir/test/python/lib/PythonTestCAPI.cpp
+++ b/mlir/test/python/lib/PythonTestCAPI.cpp
@@ -11,6 +11,8 @@
#include "mlir-c/BuiltinTypes.h"
#include "mlir/CAPI/Registration.h"
#include "mlir/CAPI/Wrap.h"
+#include "mlir/IR/Diagnostics.h"
+#include "mlir/IR/Location.h"
MLIR_DEFINE_CAPI_DIALECT_REGISTRATION(PythonTest, python_test,
python_test::PythonTestDialect)
@@ -42,3 +44,9 @@ MlirTypeID mlirPythonTestTestTypeGetTypeID(void) {
bool mlirTypeIsAPythonTestTestTensorValue(MlirValue value) {
return mlirTypeIsATensor(wrap(unwrap(value).getType()));
}
+
+void mlirPythonTestEmitDiagnosticWithNote(MlirContext ctx) {
+ auto diag =
+ mlir::emitError(unwrap(mlirLocationUnknownGet(ctx)), "created error");
+ diag.attachNote() << "attached note";
+}