[Mlir-commits] [mlir] dc860d5 - [mlir] Add has_value and value to OptionalParseResult
Kazu Hirata
llvmlistbot at llvm.org
Tue Aug 2 22:17:02 PDT 2022
Author: Kazu Hirata
Date: 2022-08-02T22:16:55-07:00
New Revision: dc860d55eb8297083ca928341b2c222d648fba2a
URL: https://github.com/llvm/llvm-project/commit/dc860d55eb8297083ca928341b2c222d648fba2a
DIFF: https://github.com/llvm/llvm-project/commit/dc860d55eb8297083ca928341b2c222d648fba2a.diff
LOG: [mlir] Add has_value and value to OptionalParseResult
llvm::Optional is in the process of switching to the
std::optional-like interface with has_value/value as opposed to
hasValue/getValue.
This patch adds has_value and value to enable the same transition.
Differential Revision: https://reviews.llvm.org/D130819
Added:
Modified:
mlir/include/mlir/IR/OpDefinition.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h
index 1e8f93a89573..27148efa0308 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -44,9 +44,11 @@ class OptionalParseResult {
OptionalParseResult(llvm::NoneType) : impl(llvm::None) {}
/// Returns true if we contain a valid ParseResult value.
+ bool has_value() const { return impl.has_value(); }
bool hasValue() const { return impl.has_value(); }
/// Access the internal ParseResult value.
+ ParseResult value() const { return impl.value(); }
ParseResult getValue() const { return impl.value(); }
ParseResult operator*() const { return getValue(); }
More information about the Mlir-commits
mailing list