[Mlir-commits] [mlir] 004933e - [mlir] Use std::nullopt instead of None (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sun Dec 4 14:40:18 PST 2022
Author: Kazu Hirata
Date: 2022-12-04T14:40:08-08:00
New Revision: 004933e46a644a86de52dd9b08d72c43854425fc
URL: https://github.com/llvm/llvm-project/commit/004933e46a644a86de52dd9b08d72c43854425fc
DIFF: https://github.com/llvm/llvm-project/commit/004933e46a644a86de52dd9b08d72c43854425fc.diff
LOG: [mlir] Use std::nullopt instead of None (NFC)
I've verified that every single instance of std::nullopt in this patch
affects generated files and would reduce the number of warnings if
None were deprecated.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Added:
Modified:
mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
index 30aa8bdad7d71..6e589cb380d03 100644
--- a/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
+++ b/mlir/include/mlir/Dialect/PDL/IR/PDLOps.td
@@ -354,11 +354,11 @@ def PDL_OperationOp : PDL_Op<"operation", [AttrSizedOperandSegments]> {
}];
let builders = [
- OpBuilder<(ins CArg<"Optional<StringRef>", "llvm::None">:$name,
- CArg<"ValueRange", "llvm::None">:$operandValues,
- CArg<"ArrayRef<StringRef>", "llvm::None">:$attrNames,
- CArg<"ValueRange", "llvm::None">:$attrValues,
- CArg<"ValueRange", "llvm::None">:$resultTypes), [{
+ OpBuilder<(ins CArg<"Optional<StringRef>", "std::nullopt">:$name,
+ CArg<"ValueRange", "std::nullopt">:$operandValues,
+ CArg<"ArrayRef<StringRef>", "std::nullopt">:$attrNames,
+ CArg<"ValueRange", "std::nullopt">:$attrValues,
+ CArg<"ValueRange", "std::nullopt">:$resultTypes), [{
auto nameAttr = name ? $_builder.getStringAttr(*name) : StringAttr();
build($_builder, $_state, $_builder.getType<OperationType>(), nameAttr,
operandValues, attrValues, $_builder.getStrArrayAttr(attrNames),
diff --git a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
index 1c0c3745665f0..147705ecb873c 100644
--- a/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
+++ b/mlir/include/mlir/Dialect/SPIRV/IR/SPIRVStructureOps.td
@@ -490,11 +490,11 @@ def SPIRV_ModuleOp : SPIRV_Op<"module",
let regions = (region AnyRegion);
let builders = [
- OpBuilder<(ins CArg<"Optional<StringRef>", "llvm::None">:$name)>,
+ OpBuilder<(ins CArg<"Optional<StringRef>", "std::nullopt">:$name)>,
OpBuilder<(ins "spirv::AddressingModel":$addressing_model,
"spirv::MemoryModel":$memory_model,
- CArg<"Optional<spirv::VerCapExtAttr>", "llvm::None">:$vce_triple,
- CArg<"Optional<StringRef>", "llvm::None">:$name)>
+ CArg<"Optional<spirv::VerCapExtAttr>", "std::nullopt">:$vce_triple,
+ CArg<"Optional<StringRef>", "std::nullopt">:$name)>
];
// We need to ensure the block inside the region is properly terminated;
More information about the Mlir-commits
mailing list