Skip to content

Commit 4e37d7b

Browse files
committed
[mlir] Fix -Wdangling-assignment-gsl in OperationSupport.h
This warning is causing lots of build spam when I use a recent Clang as my host compiler. a3b4d91 fixes the same issue in clangd; apply that fix here too. I also think this is a potential false positive though. Fix variable casing while I'm here.
1 parent f729477 commit 4e37d7b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mlir/include/mlir/IR/OperationSupport.h

Lines changed: 6 additions & 4 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+
constexpr auto deleter = [](OpaqueProperties prop) {
10011001
delete prop.as<const T *>();
10021002
};
1003-
propertiesSetter = [](OpaqueProperties new_prop,
1004-
const OpaqueProperties prop) {
1005-
*new_prop.as<T *>() = *prop.as<const T *>();
1003+
propertiesDeleter = deleter;
1004+
constexpr auto setter = [](OpaqueProperties newProp,
1005+
const OpaqueProperties prop) {
1006+
*newProp.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)