[Mlir-commits] [mlir] ecbee48 - [Builders.h] Silence a warning by adding a cast.
Chris Lattner
llvmlistbot at llvm.org
Sat Oct 16 13:30:33 PDT 2021
Author: Chris Lattner
Date: 2021-10-16T13:30:28-07:00
New Revision: ecbee4804d44c0afdf97fe59e8221c30cbbf3ae7
URL: https://github.com/llvm/llvm-project/commit/ecbee4804d44c0afdf97fe59e8221c30cbbf3ae7
DIFF: https://github.com/llvm/llvm-project/commit/ecbee4804d44c0afdf97fe59e8221c30cbbf3ae7.diff
LOG: [Builders.h] Silence a warning by adding a cast.
The no-result version of createOrFold calls 'tryFold' but
ignores the result since it doesn't matter what it produced.
Explicitly cast to void to silence this warning:
../llvm/mlir/include/mlir/IR/Builders.h:454:5: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
tryFold(op.getOperation(), unused);
^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~
Differential Revision: https://reviews.llvm.org/D111951
Added:
Modified:
mlir/include/mlir/IR/Builders.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/Builders.h b/mlir/include/mlir/IR/Builders.h
index e87796ea1404..6a50bc782f6e 100644
--- a/mlir/include/mlir/IR/Builders.h
+++ b/mlir/include/mlir/IR/Builders.h
@@ -451,7 +451,7 @@ class OpBuilder : public Builder {
createOrFold(Location location, Args &&...args) {
auto op = create<OpTy>(location, std::forward<Args>(args)...);
SmallVector<Value, 0> unused;
- tryFold(op.getOperation(), unused);
+ (void)tryFold(op.getOperation(), unused);
// Folding cannot remove a zero-result operation, so for convenience we
// continue to return it.
More information about the Mlir-commits
mailing list