Fix GCC build problem with 288f05f related to SmallVector. (#116958)
[llvm-project.git] / mlir / test / lib / Dialect / TestDyn / TestDynDialect.cpp
blob1757f1dbb873df1a08a588d85190ddbe95f726bd
1 //===- TestDynDialect.cpp -------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines a fake 'test_dyn' dynamic dialect that is used to test the
10 // registration of dynamic dialects.
12 //===----------------------------------------------------------------------===//
14 #include "mlir/IR/ExtensibleDialect.h"
16 using namespace mlir;
18 namespace test {
19 void registerTestDynDialect(DialectRegistry &registry) {
20 registry.insertDynamic(
21 "test_dyn", [](MLIRContext *ctx, DynamicDialect *testDyn) {
22 auto opVerifier = [](Operation *op) -> LogicalResult {
23 if (op->getNumOperands() == 0 && op->getNumResults() == 1 &&
24 op->getNumRegions() == 0)
25 return success();
26 return op->emitError(
27 "expected a single result, no operands and no regions");
30 auto opRegionVerifier = [](Operation *op) { return success(); };
32 testDyn->registerDynamicOp(DynamicOpDefinition::get(
33 "one_result", testDyn, opVerifier, opRegionVerifier));
34 });
36 } // namespace test