From: Kazu Hirata Date: Tue, 30 May 2023 22:32:43 +0000 (-0700) Subject: Remove llvm::Optional X-Git-Tag: upstream/17.0.6~6748 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=397f2e9ebee8d8e45547e90dd05228d7f965df67;p=platform%2Fupstream%2Fllvm.git Remove llvm::Optional 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 Differential Revision: https://reviews.llvm.org/D149128 --- diff --git a/llvm/include/llvm/ADT/None.h b/llvm/include/llvm/ADT/None.h deleted file mode 100644 index c497821..0000000 --- a/llvm/include/llvm/ADT/None.h +++ /dev/null @@ -1,31 +0,0 @@ -//===-- None.h - Simple null value for implicit construction ------*- C++ -*-=// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file provides None, an enumerator for use in implicit constructors -/// of various (usually templated) types to make such construction more -/// terse. -/// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_NONE_H -#define LLVM_ADT_NONE_H - -#include "llvm/Support/Compiler.h" -#include - -namespace llvm { -/// A simple null object to allow implicit construction of std::optional -/// and similar types without having to spell out the specialization's name. -LLVM_DEPRECATED("Use std::nullopt_t instead", "std::nullopt_t") -typedef std::nullopt_t NoneType; -LLVM_DEPRECATED("Use std::nullopt instead.", "std::nullopt") -inline constexpr std::nullopt_t None = std::nullopt; -} - -#endif diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h deleted file mode 100644 index c338283..0000000 --- a/llvm/include/llvm/ADT/Optional.h +++ /dev/null @@ -1,27 +0,0 @@ -//===- Optional.h - Simple variant for passing optional values --*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// This file provides Optional, a template class modeled in the spirit of -/// OCaml's 'opt' variant. The idea is to strongly type whether or not -/// a value can be optional. -/// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ADT_OPTIONAL_H -#define LLVM_ADT_OPTIONAL_H - -#include - -namespace llvm { -// Legacy alias of llvm::Optional to std::optional. -// FIXME: Remove this after LLVM 16. -template using Optional = std::optional; -} // namespace llvm - -#endif // LLVM_ADT_OPTIONAL_H diff --git a/mlir/include/mlir/Support/LLVM.h b/mlir/include/mlir/Support/LLVM.h index 216de42a..e55ae06 100644 --- a/mlir/include/mlir/Support/LLVM.h +++ b/mlir/include/mlir/Support/LLVM.h @@ -18,9 +18,8 @@ #ifndef MLIR_SUPPORT_LLVM_H #define MLIR_SUPPORT_LLVM_H -// We include these two headers because they cannot be practically forward +// We include this header because it cannot be practically forward // declared, and are effectively language features. -#include "llvm/ADT/None.h" #include "llvm/Support/Casting.h" #include @@ -58,7 +57,6 @@ class DenseSet; class MallocAllocator; template class MutableArrayRef; -template using Optional = std::optional; template class PointerUnion; template @@ -130,7 +128,6 @@ using SetVector = llvm::SetVector; template using StringSet = llvm::StringSet; using llvm::MutableArrayRef; -using llvm::Optional; using llvm::PointerUnion; using llvm::SmallPtrSet; using llvm::SmallPtrSetImpl;