[Mlir-commits] [mlir] [mlir] Fix -Wdangling-assignment-gsl in OperationSupport.h (PR #126140)
Shoaib Meenai
llvmlistbot at llvm.org
Thu Feb 6 14:10:58 PST 2025
https://github.com/smeenai created https://github.com/llvm/llvm-project/pull/126140
This warning is causing lots of build spam when I use a recent Clang as
my host compiler. a3b4d9147406cbd90090466a9b2b9bb2e9f6000c 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.
>From 4e37d7b3789db4cbdfd952a0921cfdb0b95984e0 Mon Sep 17 00:00:00 2001
From: Shoaib Meenai <smeenai at fb.com>
Date: Thu, 6 Feb 2025 14:05:01 -0800
Subject: [PATCH] [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. a3b4d9147406cbd90090466a9b2b9bb2e9f6000c 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.
---
mlir/include/mlir/IR/OperationSupport.h | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index d4035d14ab74650..bcbf9458ff96e7f 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -997,13 +997,15 @@ struct OperationState {
if (!properties) {
T *p = new T{};
properties = p;
- propertiesDeleter = [](OpaqueProperties prop) {
+ constexpr auto deleter = [](OpaqueProperties prop) {
delete prop.as<const T *>();
};
- propertiesSetter = [](OpaqueProperties new_prop,
- const OpaqueProperties prop) {
- *new_prop.as<T *>() = *prop.as<const T *>();
+ propertiesDeleter = deleter;
+ constexpr auto setter = [](OpaqueProperties newProp,
+ const OpaqueProperties prop) {
+ *newProp.as<T *>() = *prop.as<const T *>();
};
+ propertiesSetter = setter;
propertiesId = TypeID::get<T>();
}
assert(propertiesId == TypeID::get<T>() && "Inconsistent properties");
More information about the Mlir-commits
mailing list