From 3f74334c38120bbdefac012d478dfce8e4eb0906 Mon Sep 17 00:00:00 2001 From: Maksim Levental Date: Thu, 24 Jul 2025 18:05:25 -0500 Subject: [mlir][NFC] update `flang` create APIs (13/n) (#149913) See https://github.com/llvm/llvm-project/pull/147168 for more info. --- flang/unittests/Frontend/CodeGenActionTest.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'flang/unittests/Frontend/CodeGenActionTest.cpp') diff --git a/flang/unittests/Frontend/CodeGenActionTest.cpp b/flang/unittests/Frontend/CodeGenActionTest.cpp index 6020abc..e606456 100644 --- a/flang/unittests/Frontend/CodeGenActionTest.cpp +++ b/flang/unittests/Frontend/CodeGenActionTest.cpp @@ -50,6 +50,15 @@ public: static void build( ::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState) {} + + static FakeOp create( + ::mlir::OpBuilder &odsBuilder, ::mlir::Location location) { + ::mlir::OperationState state(location, getOperationName()); + build(odsBuilder, state); + auto res = ::llvm::dyn_cast(odsBuilder.create(state)); + assert(res && "builder didn't return the right type"); + return res; + } }; } // namespace dummy } // namespace test @@ -77,7 +86,7 @@ public: mlir::OpBuilder builder(mlirCtx.get()); builder.setInsertionPointToStart(&mlirModule->getRegion().front()); // Create a fake op to trip conversion to LLVM. - builder.create(loc); + test::dummy::FakeOp::create(builder, loc); llvmCtx = std::make_unique(); } -- cgit v1.1