[Mlir-commits] [mlir] 1adfdab - [ComplexToLibm] Use std::optional in ComplexToLibm.cpp (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sat Dec 10 10:40:41 PST 2022


Author: Kazu Hirata
Date: 2022-12-10T10:40:35-08:00
New Revision: 1adfdab39936e3fe6f4b7bca945f3d46b4b075e3

URL: https://github.com/llvm/llvm-project/commit/1adfdab39936e3fe6f4b7bca945f3d46b4b075e3
DIFF: https://github.com/llvm/llvm-project/commit/1adfdab39936e3fe6f4b7bca945f3d46b4b075e3.diff

LOG: [ComplexToLibm] Use std::optional in ComplexToLibm.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/Conversion/ComplexToLibm/ComplexToLibm.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
index fa8db2c965175..cf98263e62249 100644
--- a/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
+++ b/mlir/lib/Conversion/ComplexToLibm/ComplexToLibm.cpp
@@ -12,6 +12,7 @@
 #include "mlir/Dialect/Func/IR/FuncOps.h"
 #include "mlir/IR/PatternMatch.h"
 #include "mlir/Pass/Pass.h"
+#include <optional>
 
 namespace mlir {
 #define GEN_PASS_DEF_CONVERTCOMPLEXTOLIBM
@@ -24,7 +25,7 @@ namespace {
 // Functor to resolve the function name corresponding to the given complex
 // result type.
 struct ComplexTypeResolver {
-  llvm::Optional<bool> operator()(Type type) const {
+  std::optional<bool> operator()(Type type) const {
     auto complexType = type.cast<ComplexType>();
     auto elementType = complexType.getElementType();
     if (!elementType.isa<Float32Type, Float64Type>())
@@ -37,7 +38,7 @@ struct ComplexTypeResolver {
 // Functor to resolve the function name corresponding to the given float result
 // type.
 struct FloatTypeResolver {
-  llvm::Optional<bool> operator()(Type type) const {
+  std::optional<bool> operator()(Type type) const {
     auto elementType = type.cast<FloatType>();
     if (!elementType.isa<Float32Type, Float64Type>())
       return {};


        


More information about the Mlir-commits mailing list