[Mlir-commits] [mlir] [mlir] Fix -Wdangling-assignment-gsl in OperationSupport.h (PR #126140)
Shoaib Meenai
llvmlistbot at llvm.org
Mon Feb 10 14:02:54 PST 2025
https://github.com/smeenai updated https://github.com/llvm/llvm-project/pull/126140
>From 265d1907e29a5503e1d45f411f80fbd3e2a226e7 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] Silence -Wdangling-assignment-gsl in
OperationSupport.h
This warning is causing lots of build spam when I use a recent Clang as
my host compiler. It's a potential false positive, so silence it until
https://github.com/llvm/llvm-project/issues/126600 is resolved.
---
mlir/include/mlir/IR/OperationSupport.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index d4035d14ab74650..b29b2bb1b9b5294 100644
--- a/mlir/include/mlir/IR/OperationSupport.h
+++ b/mlir/include/mlir/IR/OperationSupport.h
@@ -997,13 +997,21 @@ struct OperationState {
if (!properties) {
T *p = new T{};
properties = p;
+#if defined(__clang__) && __has_warning("-Wdangling-assignment-gsl")
+#pragma clang diagnostic push
+// https://github.com/llvm/llvm-project/issues/126600
+#pragma clang diagnostic ignored "-Wdangling-assignment-gsl"
+#endif
propertiesDeleter = [](OpaqueProperties prop) {
delete prop.as<const T *>();
};
- propertiesSetter = [](OpaqueProperties new_prop,
+ propertiesSetter = [](OpaqueProperties newProp,
const OpaqueProperties prop) {
- *new_prop.as<T *>() = *prop.as<const T *>();
+ *newProp.as<T *>() = *prop.as<const T *>();
};
+#if defined(__clang__) && __has_warning("-Wdangling-assignment-gsl")
+#pragma clang diagnostic pop
+#endif
propertiesId = TypeID::get<T>();
}
assert(propertiesId == TypeID::get<T>() && "Inconsistent properties");
More information about the Mlir-commits
mailing list