[Mlir-commits] [mlir] b237941 - [Reader] Use std::optional in BytecodeReader.cpp (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sat Dec 10 10:31:32 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T10:31:26-08:00
New Revision: b2379415b9b4d86565cae9d9df753fb6f7e7513b
URL: https://github.com/llvm/llvm-project/commit/b2379415b9b4d86565cae9d9df753fb6f7e7513b
DIFF: https://github.com/llvm/llvm-project/commit/b2379415b9b4d86565cae9d9df753fb6f7e7513b.diff
LOG: [Reader] Use std::optional in BytecodeReader.cpp (NFC)
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/lib/Bytecode/Reader/BytecodeReader.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index 8c08ca7bb7d15..590986eb6d079 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -23,6 +23,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MemoryBufferRef.h"
#include "llvm/Support/SaveAndRestore.h"
+#include <optional>
#define DEBUG_TYPE "mlir-bytecode-reader"
@@ -435,11 +436,11 @@ struct BytecodeDialect {
/// The loaded dialect entry. This field is None if we haven't attempted to
/// load, nullptr if we failed to load, otherwise the loaded dialect.
- Optional<Dialect *> dialect;
+ std::optional<Dialect *> dialect;
/// The bytecode interface of the dialect, or nullptr if the dialect does not
/// implement the bytecode interface. This field should only be checked if the
- /// `dialect` field is non-None.
+ /// `dialect` field is not std::nullopt.
const BytecodeDialectInterface *interface = nullptr;
/// The name of the dialect.
@@ -453,7 +454,7 @@ struct BytecodeOperationName {
/// The loaded operation name, or std::nullopt if it hasn't been processed
/// yet.
- Optional<OperationName> opName;
+ std::optional<OperationName> opName;
/// The dialect that owns this operation name.
BytecodeDialect *dialect;
More information about the Mlir-commits
mailing list