[Mlir-commits] [mlir] 5c4674d - [mlir] Deprecate OptionalParseResult::{hasValue, getValue}

Kazu Hirata llvmlistbot at llvm.org
Fri Aug 12 19:19:36 PDT 2022


Author: Kazu Hirata
Date: 2022-08-12T19:19:24-07:00
New Revision: 5c4674d67b06c5b4a845f26a614fc453a6bfb1f6

URL: https://github.com/llvm/llvm-project/commit/5c4674d67b06c5b4a845f26a614fc453a6bfb1f6
DIFF: https://github.com/llvm/llvm-project/commit/5c4674d67b06c5b4a845f26a614fc453a6bfb1f6.diff

LOG: [mlir] Deprecate OptionalParseResult::{hasValue,getValue}

This patch deprecates hasValue and getValue for consistency with
std::optional and llvm::Optional.  Note that I've migrated all known
uses of them to has_value and value, respectively.

Differential Revision: https://reviews.llvm.org/D131366

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 e2aa3bfce43d..8bd3402745f1 100644
--- a/mlir/include/mlir/IR/OpDefinition.h
+++ b/mlir/include/mlir/IR/OpDefinition.h
@@ -45,11 +45,15 @@ class OptionalParseResult {
 
   /// Returns true if we contain a valid ParseResult value.
   bool has_value() const { return impl.has_value(); }
-  bool hasValue() const { return impl.has_value(); }
+  LLVM_DEPRECATED("Use has_value instead", "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(); }
+  LLVM_DEPRECATED("Use value instead", "value") ParseResult getValue() const {
+    return impl.value();
+  }
   ParseResult operator*() const { return value(); }
 
 private:


        


More information about the Mlir-commits mailing list