Skip to content

Commit eae0773

Browse files
Fix memory destructors not called for frame variables
1 parent 8891d5d commit eae0773

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

lib/dialect/src/LowerActionPass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -132,6 +132,7 @@ namespace mlir::rlc
132132
builtinOperatorName<mlir::rlc::AssignOp>(),
133133
mlir::ValueRange({ refToMember, decl }));
134134
assert(call != nullptr);
135+
builder.emitCall(decl, true, "drop", mlir::ValueRange({ decl }), false);
135136
}
136137
}
137138

lib/dialect/src/SymbolTable.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
77
8-
http://www.apache.org/licenses/LICENSE-2.0
8+
http://www.apache.org/licenses/LICENSE-2.0
99
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
@@ -583,8 +583,8 @@ mlir::Operation* mlir::rlc::ModuleBuilder::emitCall(
583583
return maybeCast;
584584

585585
auto argTypes = arguments.getType();
586-
auto overload = resolveFunctionCall(
587-
emitLog ? callSite : nullptr, isMemberCall, name, arguments);
586+
auto overload =
587+
resolveFunctionCall(callSite, isMemberCall, name, arguments, emitLog);
588588

589589
if (overload == nullptr)
590590
return nullptr;

tool/rlc/test/vector_in_action.rl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# RUN: rlc %s -o %t -i %stdlib --sanitize -g
2+
# RUN: %t
3+
4+
import collections.vector
5+
6+
act has_member() -> HM:
7+
frm member: Vector<Int>
8+
9+
fun main() -> Int:
10+
let hm = has_member()
11+
return 0

0 commit comments

Comments
 (0)