Skip to content

Commit

Permalink
Reland "[mlir] Silence -Wdangling-assignment-gsl in OperationSupport.h"
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
smeenai committed Feb 25, 2025
1 parent ecc7e6c commit 6e3b475
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions mlir/include/mlir/IR/OperationSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -997,13 +997,25 @@ struct OperationState {
if (!properties) {
T *p = new T{};
properties = p;
#if defined(__clang__)
#if __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
#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__)
#if __has_warning("-Wdangling-assignment-gsl")
#pragma clang diagnostic pop
#endif
#endif
propertiesId = TypeID::get<T>();
}
assert(propertiesId == TypeID::get<T>() && "Inconsistent properties");
Expand Down

0 comments on commit 6e3b475

Please sign in to comment.