[mlir][examples] Fix deprecation warnings for ArrayRef(std::nullopt) (#146420)
This used to print:
```
llvm-project/mlir/include/mlir/IR/ValueRange.h:401:20: warning: 'ArrayRef' is deprecated: Use {} or ArrayRef<T>() instead [-Wdeprecated-declarations]
401 | : ValueRange(ArrayRef<Value>(std::forward<Arg>(arg))) {}
| ^~~~~~~~
| {}
build/tools/mlir/examples/toy/Ch7/include/toy/Ops.cpp.inc:2221:30: note: in instantiation of function template specialization 'mlir::ValueRange::ValueRange<const std::nullopt_t &, void>' requested here
2221 | build(odsBuilder, odsState, std::nullopt);
| ^
llvm-project/llvm/include/llvm/ADT/ArrayRef.h:70:18: note: 'ArrayRef' has been explicitly marked deprecated here
70 | /*implicit*/ LLVM_DEPRECATED("Use {} or ArrayRef<T>() instead", "{}")
| ^
llvm-project/llvm/include/llvm/Support/Compiler.h:249:50: note: expanded from macro 'LLVM_DEPRECATED'
249 | #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX)))
```
This commit is contained in:
@@ -297,7 +297,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
|
|||||||
|
|
||||||
// Allow building a ReturnOp with no return operand.
|
// Allow building a ReturnOp with no return operand.
|
||||||
let builders = [
|
let builders = [
|
||||||
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
|
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
|
||||||
];
|
];
|
||||||
|
|
||||||
// Provide extra utility definitions on the c++ operation class definition.
|
// Provide extra utility definitions on the c++ operation class definition.
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
|
|||||||
|
|
||||||
// Allow building a ReturnOp with no return operand.
|
// Allow building a ReturnOp with no return operand.
|
||||||
let builders = [
|
let builders = [
|
||||||
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
|
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
|
||||||
];
|
];
|
||||||
|
|
||||||
// Provide extra utility definitions on the c++ operation class definition.
|
// Provide extra utility definitions on the c++ operation class definition.
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
|
|||||||
|
|
||||||
// Allow building a ReturnOp with no return operand.
|
// Allow building a ReturnOp with no return operand.
|
||||||
let builders = [
|
let builders = [
|
||||||
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
|
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
|
||||||
];
|
];
|
||||||
|
|
||||||
// Provide extra utility definitions on the c++ operation class definition.
|
// Provide extra utility definitions on the c++ operation class definition.
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
|
|||||||
|
|
||||||
// Allow building a ReturnOp with no return operand.
|
// Allow building a ReturnOp with no return operand.
|
||||||
let builders = [
|
let builders = [
|
||||||
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
|
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
|
||||||
];
|
];
|
||||||
|
|
||||||
// Provide extra utility definitions on the c++ operation class definition.
|
// Provide extra utility definitions on the c++ operation class definition.
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
|
|||||||
|
|
||||||
// Allow building a ReturnOp with no return operand.
|
// Allow building a ReturnOp with no return operand.
|
||||||
let builders = [
|
let builders = [
|
||||||
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
|
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
|
||||||
];
|
];
|
||||||
|
|
||||||
// Provide extra utility definitions on the c++ operation class definition.
|
// Provide extra utility definitions on the c++ operation class definition.
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
|
|||||||
|
|
||||||
// Allow building a ReturnOp with no return operand.
|
// Allow building a ReturnOp with no return operand.
|
||||||
let builders = [
|
let builders = [
|
||||||
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
|
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
|
||||||
];
|
];
|
||||||
|
|
||||||
// Provide extra utility definitions on the c++ operation class definition.
|
// Provide extra utility definitions on the c++ operation class definition.
|
||||||
|
|||||||
Reference in New Issue
Block a user