mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-30 05:36:44 +00:00
Fix memory leaks in MLIR unit-tests (NFC)
This commit is contained in:
parent
107198fe7d
commit
57d9adefa0
@ -189,6 +189,8 @@ void testParsePassPipeline() {
|
||||
mlirPrintPassPipeline(mlirPassManagerGetAsOpPassManager(pm), printToStderr,
|
||||
NULL);
|
||||
fprintf(stderr, "\n");
|
||||
mlirPassManagerDestroy(pm);
|
||||
mlirContextDestroy(ctx);
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "mlir/IR/OwningOpRef.h"
|
||||
#include "mlir/IR/PatternMatch.h"
|
||||
#include "mlir/Rewrite/PatternApplicator.h"
|
||||
#include "gtest/gtest.h"
|
||||
@ -20,7 +21,7 @@ TEST(PatternBenefitTest, BenefitOrder) {
|
||||
MLIRContext context;
|
||||
|
||||
OpBuilder builder(&context);
|
||||
auto module = ModuleOp::create(builder.getUnknownLoc());
|
||||
OwningOpRef<ModuleOp> module = ModuleOp::create(builder.getUnknownLoc());
|
||||
|
||||
struct Pattern1 : public OpRewritePattern<ModuleOp> {
|
||||
Pattern1(mlir::MLIRContext *context, bool *called)
|
||||
@ -71,7 +72,7 @@ TEST(PatternBenefitTest, BenefitOrder) {
|
||||
};
|
||||
|
||||
MyPatternRewriter rewriter(&context);
|
||||
(void)pa.matchAndRewrite(module, rewriter);
|
||||
(void)pa.matchAndRewrite(*module, rewriter);
|
||||
|
||||
EXPECT_TRUE(called1);
|
||||
EXPECT_TRUE(called2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user