From: Kazu Hirata Date: Tue, 3 Jan 2023 02:56:09 +0000 (-0800) Subject: [mlir] Use std::optional instead of llvm::Optional (NFC) X-Git-Tag: upstream/17.0.6~22352 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5273219e57a85ea360639e21d2fcc8b3edc429f5;p=platform%2Fupstream%2Fllvm.git [mlir] Use std::optional instead of llvm::Optional (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 --- diff --git a/mlir/lib/ExecutionEngine/OptUtils.cpp b/mlir/lib/ExecutionEngine/OptUtils.cpp index a720305..69216c5 100644 --- a/mlir/lib/ExecutionEngine/OptUtils.cpp +++ b/mlir/lib/ExecutionEngine/OptUtils.cpp @@ -20,11 +20,12 @@ #include "llvm/Support/Error.h" #include "llvm/Support/FormatVariadic.h" #include "llvm/Target/TargetMachine.h" +#include using namespace llvm; -static Optional mapToLevel(unsigned optLevel, - unsigned sizeLevel) { +static std::optional mapToLevel(unsigned optLevel, + unsigned sizeLevel) { switch (optLevel) { case 0: return OptimizationLevel::O0; @@ -55,7 +56,7 @@ std::function mlir::makeOptimizingTransformer(unsigned optLevel, unsigned sizeLevel, TargetMachine *targetMachine) { return [optLevel, sizeLevel, targetMachine](Module *m) -> Error { - Optional ol = mapToLevel(optLevel, sizeLevel); + std::optional ol = mapToLevel(optLevel, sizeLevel); if (!ol) { return make_error( formatv("invalid optimization/size level {0}/{1}", optLevel,