[PATCH] D149128: Remove llvm::Optional
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 23:48:28 PDT 2023
kazu created this revision.
Herald added subscribers: bviyer, Moerafaat, zero9178, bzcheeseman, awarzynski, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, thopre.
Herald added a reviewer: ftynse.
Herald added a reviewer: dcaballe.
Herald added a project: All.
kazu requested review of this revision.
Herald added subscribers: llvm-commits, stephenneuendorffer, nicolasvasilache.
Herald added projects: MLIR, LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149128
Files:
llvm/include/llvm/ADT/None.h
llvm/include/llvm/ADT/Optional.h
mlir/include/mlir/Support/LLVM.h
Index: mlir/include/mlir/Support/LLVM.h
===================================================================
--- mlir/include/mlir/Support/LLVM.h
+++ 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 <vector>
@@ -58,7 +57,6 @@
class MallocAllocator;
template <typename T>
class MutableArrayRef;
-template <typename T> using Optional = std::optional<T>;
template <typename... PT>
class PointerUnion;
template <typename T, typename Vector, typename Set>
@@ -130,7 +128,6 @@
template <typename AllocatorTy = llvm::MallocAllocator>
using StringSet = llvm::StringSet<AllocatorTy>;
using llvm::MutableArrayRef;
-using llvm::Optional;
using llvm::PointerUnion;
using llvm::SmallPtrSet;
using llvm::SmallPtrSetImpl;
Index: llvm/include/llvm/ADT/Optional.h
===================================================================
--- 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 <optional>
-
-namespace llvm {
-// Legacy alias of llvm::Optional to std::optional.
-// FIXME: Remove this after LLVM 16.
-template <class T> using Optional = std::optional<T>;
-} // namespace llvm
-
-#endif // LLVM_ADT_OPTIONAL_H
Index: llvm/include/llvm/ADT/None.h
===================================================================
--- 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 <optional>
-
-namespace llvm {
-/// A simple null object to allow implicit construction of std::optional<T>
-/// 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149128.516637.patch
Type: text/x-patch
Size: 3518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/c10ae12e/attachment.bin>
More information about the llvm-commits
mailing list