[Mlir-commits] [mlir] e2e572a - [AsmParser] Use std::optional in Parser.cpp (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Sat Dec 10 10:29:00 PST 2022
Author: Kazu Hirata
Date: 2022-12-10T10:28:55-08:00
New Revision: e2e572a8d4ec75db458f8d6ab91896b7e41837f5
URL: https://github.com/llvm/llvm-project/commit/e2e572a8d4ec75db458f8d6ab91896b7e41837f5
DIFF: https://github.com/llvm/llvm-project/commit/e2e572a8d4ec75db458f8d6ab91896b7e41837f5.diff
LOG: [AsmParser] Use std::optional in Parser.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/Parser.cpp
Removed:
################################################################################
diff --git a/mlir/lib/AsmParser/Parser.cpp b/mlir/lib/AsmParser/Parser.cpp
index 75298ec5329d..7eb839d875b1 100644
--- a/mlir/lib/AsmParser/Parser.cpp
+++ b/mlir/lib/AsmParser/Parser.cpp
@@ -28,6 +28,7 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/SourceMgr.h"
#include <algorithm>
+#include <optional>
using namespace mlir;
using namespace mlir::detail;
@@ -501,7 +502,7 @@ class OperationParser : public Parser {
/// Return the location of the value identified by its name and number if it
/// has been already reference.
- Optional<SMLoc> getReferenceLoc(StringRef name, unsigned number) {
+ std::optional<SMLoc> getReferenceLoc(StringRef name, unsigned number) {
auto &values = isolatedNameScopes.back().values;
if (!values.count(name) || number >= values[name].size())
return {};
More information about the Mlir-commits
mailing list