Skip to content

Commit ff4faaa

Browse files
authored
[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))) ```
1 parent f16983f commit ff4faaa

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

mlir/examples/toy/Ch2/include/toy/Ops.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
297297

298298
// Allow building a ReturnOp with no return operand.
299299
let builders = [
300-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
300+
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
301301
];
302302

303303
// Provide extra utility definitions on the c++ operation class definition.

mlir/examples/toy/Ch3/include/toy/Ops.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
298298

299299
// Allow building a ReturnOp with no return operand.
300300
let builders = [
301-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
301+
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
302302
];
303303

304304
// Provide extra utility definitions on the c++ operation class definition.

mlir/examples/toy/Ch4/include/toy/Ops.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
335335

336336
// Allow building a ReturnOp with no return operand.
337337
let builders = [
338-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
338+
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
339339
];
340340

341341
// Provide extra utility definitions on the c++ operation class definition.

mlir/examples/toy/Ch5/include/toy/Ops.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
335335

336336
// Allow building a ReturnOp with no return operand.
337337
let builders = [
338-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
338+
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
339339
];
340340

341341
// Provide extra utility definitions on the c++ operation class definition.

mlir/examples/toy/Ch6/include/toy/Ops.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
335335

336336
// Allow building a ReturnOp with no return operand.
337337
let builders = [
338-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
338+
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
339339
];
340340

341341
// Provide extra utility definitions on the c++ operation class definition.

mlir/examples/toy/Ch7/include/toy/Ops.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def ReturnOp : Toy_Op<"return", [Pure, HasParent<"FuncOp">,
360360

361361
// Allow building a ReturnOp with no return operand.
362362
let builders = [
363-
OpBuilder<(ins), [{ build($_builder, $_state, std::nullopt); }]>
363+
OpBuilder<(ins), [{ build($_builder, $_state, {}); }]>
364364
];
365365

366366
// Provide extra utility definitions on the c++ operation class definition.

0 commit comments

Comments
 (0)