Skip to content

Commit f3966ca

Browse files
committed
[MLIR] Use static function to replace lamda function
Use static function to replace lamda function due to the lamda function's lifetime issue, which may be report an compilation error when use this template. Signed-off-by: Leon Lu <[email protected]>
1 parent b6be53d commit f3966ca

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mlir/include/mlir/IR/OperationSupport.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -997,13 +997,15 @@ struct OperationState {
997997
if (!properties) {
998998
T *p = new T{};
999999
properties = p;
1000-
propertiesDeleter = [](OpaqueProperties prop) {
1000+
static auto deleter = [](OpaqueProperties prop) {
10011001
delete prop.as<const T *>();
10021002
};
1003-
propertiesSetter = [](OpaqueProperties new_prop,
1004-
const OpaqueProperties prop) {
1003+
propertiesDeleter = deleter;
1004+
static auto setter = [](OpaqueProperties new_prop,
1005+
const OpaqueProperties prop) {
10051006
*new_prop.as<T *>() = *prop.as<const T *>();
10061007
};
1008+
propertiesSetter = setter;
10071009
propertiesId = TypeID::get<T>();
10081010
}
10091011
assert(propertiesId == TypeID::get<T>() && "Inconsistent properties");

0 commit comments

Comments
 (0)