// // This file is distributed under the MIT License. See LICENSE.md for details. // #include "mlir/IR/Diagnostics.h" #include "revng/Clift/Clift.h" #include "revng/CliftImportModel/ImportModel.h" template static auto withContext(CallableType Callable) { mlir::MLIRContext Context; Context.loadDialect(); const auto EmitError = [&]() -> mlir::InFlightDiagnostic { return Context.getDiagEngine().emit(mlir::UnknownLoc::get(&Context), mlir::DiagnosticSeverity::Remark); }; return Callable(EmitError, &Context); } static bool verify(const model::TypeDefinition &ModelType, const model::Binary &Binary, const bool Assert) { return withContext([&](const auto EmitError, mlir::MLIRContext *Context) { return static_cast(clift::importType(EmitError, Context, ModelType)); }); } static bool verify(const model::Type &ModelType, const model::Binary &Binary, bool Assert) { return withContext([&](const auto EmitError, mlir::MLIRContext *Context) { return static_cast(clift::importType(EmitError, Context, ModelType)); }); } static bool verify(const model::Binary &Tree, const bool Assert) { return Tree.verify(Assert); } static bool checkSerialization(const TupleTree &Tree) { return true; } #include "revng/tests/unit/ModelType.inc"