[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:
Jakub Kuderski 2025-06-30 18:14:33 -04:00 committed by GitHub
parent f16983f7d0
commit ff4faaa660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 6 additions and 6 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.