Skip to content

Commit 6e3b475

Browse files
committed
Reland "[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 llvm#126600 is resolved. Reland of llvm#126140 with fix for non-Clang compilers (the preprocessor doesn't short-circuit conditionals the way I thought it did).
1 parent ecc7e6c commit 6e3b475

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

mlir/include/mlir/IR/OperationSupport.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -997,13 +997,25 @@ struct OperationState {
997997
if (!properties) {
998998
T *p = new T{};
999999
properties = p;
1000+
#if defined(__clang__)
1001+
#if __has_warning("-Wdangling-assignment-gsl")
1002+
#pragma clang diagnostic push
1003+
// https://github.com/llvm/llvm-project/issues/126600
1004+
#pragma clang diagnostic ignored "-Wdangling-assignment-gsl"
1005+
#endif
1006+
#endif
10001007
propertiesDeleter = [](OpaqueProperties prop) {
10011008
delete prop.as<const T *>();
10021009
};
1003-
propertiesSetter = [](OpaqueProperties new_prop,
1010+
propertiesSetter = [](OpaqueProperties newProp,
10041011
const OpaqueProperties prop) {
1005-
*new_prop.as<T *>() = *prop.as<const T *>();
1012+
*newProp.as<T *>() = *prop.as<const T *>();
10061013
};
1014+
#if defined(__clang__)
1015+
#if __has_warning("-Wdangling-assignment-gsl")
1016+
#pragma clang diagnostic pop
1017+
#endif
1018+
#endif
10071019
propertiesId = TypeID::get<T>();
10081020
}
10091021
assert(propertiesId == TypeID::get<T>() && "Inconsistent properties");

0 commit comments

Comments
 (0)