[Mlir-commits] [mlir] f6556af - [mlir] Silence -Wdangling-assignment-gsl in OperationSupport.h (#126140)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Feb 11 14:05:06 PST 2025


Author: Shoaib Meenai
Date: 2025-02-11T14:05:01-08:00
New Revision: f6556afce0aa5a72ef42103875101d975e810474

URL: https://github.com/llvm/llvm-project/commit/f6556afce0aa5a72ef42103875101d975e810474
DIFF: https://github.com/llvm/llvm-project/commit/f6556afce0aa5a72ef42103875101d975e810474.diff

LOG: [mlir] Silence -Wdangling-assignment-gsl in OperationSupport.h (#126140)

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.
Fix variable casing while I'm here.

Added: 
    

Modified: 
    mlir/include/mlir/IR/OperationSupport.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/OperationSupport.h b/mlir/include/mlir/IR/OperationSupport.h
index d4035d14ab746..b29b2bb1b9b52 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