[Reader] Use std::optional in BytecodeReader.cpp (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 10 Dec 2022 18:31:26 +0000 (10:31 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 10 Dec 2022 18:31:26 +0000 (10:31 -0800)
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

mlir/lib/Bytecode/Reader/BytecodeReader.cpp

index 8c08ca7bb7d1552f51e6bf19cd1255b8b11dffdd..590986eb6d079e4326117d20a486de7bc4c0ad01 100644 (file)
@@ -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;