aboutsummaryrefslogtreecommitdiff
path: root/flang/unittests/Frontend/CodeGenActionTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/unittests/Frontend/CodeGenActionTest.cpp')
-rw-r--r--flang/unittests/Frontend/CodeGenActionTest.cpp11
1 files changed, 10 insertions, 1 deletions
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<FakeOp>(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<test::dummy::FakeOp>(loc);
+ test::dummy::FakeOp::create(builder, loc);
llvmCtx = std::make_unique<llvm::LLVMContext>();
}