aboutsummaryrefslogtreecommitdiff
path: root/flang/unittests/Frontend/CodeGenActionTest.cpp
diff options
context:
space:
mode:
authorMatthias Springer <me@m-sp.org>2024-12-25 09:42:03 +0100
committerGitHub <noreply@github.com>2024-12-25 09:42:03 +0100
commitc870632ef6162fbdccaad8cd09420728220ad344 (patch)
tree0517c1dd34914e29f5b4cd4bad2d2c97e96c833c /flang/unittests/Frontend/CodeGenActionTest.cpp
parentc29536b0336586b2ed7bafedf82c9f4e254cfaa6 (diff)
downloadllvm-c870632ef6162fbdccaad8cd09420728220ad344.zip
llvm-c870632ef6162fbdccaad8cd09420728220ad344.tar.gz
llvm-c870632ef6162fbdccaad8cd09420728220ad344.tar.bz2
[flang] Fix some memory leaks (#121050)
This commit fixes some but not all memory leaks in Flang. There are still 91 tests that fail with ASAN. - Use `mlir::OwningOpRef` instead of `std::unique_ptr`. The latter does not free allocations of nested blocks. - Pass `ModuleOp` as value instead of reference. - Add few missing deallocations in test cases and other places.
Diffstat (limited to 'flang/unittests/Frontend/CodeGenActionTest.cpp')
-rw-r--r--flang/unittests/Frontend/CodeGenActionTest.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/flang/unittests/Frontend/CodeGenActionTest.cpp b/flang/unittests/Frontend/CodeGenActionTest.cpp
index 5d75de0..e9ff095 100644
--- a/flang/unittests/Frontend/CodeGenActionTest.cpp
+++ b/flang/unittests/Frontend/CodeGenActionTest.cpp
@@ -72,8 +72,7 @@ public:
mlirCtx->loadDialect<test::DummyDialect>();
mlir::Location loc(mlir::UnknownLoc::get(mlirCtx.get()));
- mlirModule =
- std::make_unique<mlir::ModuleOp>(mlir::ModuleOp::create(loc, "mod"));
+ mlirModule = mlir::ModuleOp::create(loc, "mod");
mlir::OpBuilder builder(mlirCtx.get());
builder.setInsertionPointToStart(&mlirModule->getRegion().front());