llvm/mlir/unittests/IR/OpPropertiesTest.cpp

//===- TestOpProperties.cpp - Test all properties-related APIs ------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "mlir/IR/Attributes.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/Parser/Parser.h"
#include "gtest/gtest.h"
#include <optional>

usingnamespacemlir;

namespace {
/// Simple structure definining a struct to define "properties" for a given
/// operation. Default values are honored when creating an operation.
struct TestProperties {};

bool operator==(const TestProperties &lhs, TestProperties &rhs) {}

/// Convert a DictionaryAttr to a TestProperties struct, optionally emit errors
/// through the provided diagnostic if any. This is used for example during
/// parsing with the generic format.
static LogicalResult
setPropertiesFromAttribute(TestProperties &prop, Attribute attr,
                           function_ref<InFlightDiagnostic()> emitError) {}

/// Convert a TestProperties struct to a DictionaryAttr, this is used for
/// example during printing with the generic format.
static Attribute getPropertiesAsAttribute(MLIRContext *ctx,
                                          const TestProperties &prop) {}

inline llvm::hash_code computeHash(const TestProperties &prop) {}

/// A custom operation for the purpose of showcasing how to use "properties".
class OpWithProperties : public Op<OpWithProperties> {};

/// A custom operation for the purpose of showcasing how discardable attributes
/// are handled in absence of properties.
class OpWithoutProperties : public Op<OpWithoutProperties> {};

// A trivial supporting dialect to register the above operation.
class TestOpPropertiesDialect : public Dialect {};

constexpr StringLiteral mlirSrc =;

TEST(OpPropertiesTest, Properties) {}

// Test diagnostic emission when using invalid dictionary.
TEST(OpPropertiesTest, FailedProperties) {}

TEST(OpPropertiesTest, DefaultValues) {}

TEST(OpPropertiesTest, Cloning) {}

TEST(OpPropertiesTest, Equivalence) {}

TEST(OpPropertiesTest, getOrAddProperties) {}

constexpr StringLiteral withoutPropertiesAttrsSrc =;

TEST(OpPropertiesTest, withoutPropertiesDiscardableAttrs) {}

} // namespace