[Mlir-commits] [mlir] d8be208 - [AsmParser] Use std::optional in AttributeParser.cpp (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sat Dec 10 10:27:50 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T10:27:45-08:00
New Revision: d8be20818858629351a8f097ebd7a78fe8a50dac
URL: https://github.com/llvm/llvm-project/commit/d8be20818858629351a8f097ebd7a78fe8a50dac
DIFF: https://github.com/llvm/llvm-project/commit/d8be20818858629351a8f097ebd7a78fe8a50dac.diff
LOG: [AsmParser] Use std::optional in AttributeParser.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/AsmParser/AttributeParser.cpp
Removed:
################################################################################
diff --git a/mlir/lib/AsmParser/AttributeParser.cpp b/mlir/lib/AsmParser/AttributeParser.cpp
index b768be036778b..589c4b00ad3af 100644
--- a/mlir/lib/AsmParser/AttributeParser.cpp
+++ b/mlir/lib/AsmParser/AttributeParser.cpp
@@ -23,6 +23,7 @@
#include "mlir/IR/IntegerSet.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/Endian.h"
+#include <optional>
using namespace mlir;
using namespace mlir::detail;
@@ -290,7 +291,7 @@ ParseResult Parser::parseAttributeDict(NamedAttrList &attributes) {
llvm::SmallDenseSet<StringAttr> seenKeys;
auto parseElt = [&]() -> ParseResult {
// The name of an attribute can either be a bare identifier, or a string.
- Optional<StringAttr> nameId;
+ std::optional<StringAttr> nameId;
if (getToken().is(Token::string))
nameId = builder.getStringAttr(getToken().getStringValue());
else if (getToken().isAny(Token::bare_identifier, Token::inttype) ||
@@ -512,7 +513,7 @@ class TensorLiteralParser {
std::vector<std::pair<bool, Token>> storage;
/// Storage used when parsing elements that were stored as hex values.
- Optional<Token> hexStorage;
+ std::optional<Token> hexStorage;
};
} // namespace
More information about the Mlir-commits
mailing list