[PATCH] D149128: Remove llvm::Optional

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 30 15:33:02 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG397f2e9ebee8: Remove llvm::Optional (authored by kazu).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149128/new/

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.526817.patch
Type: text/x-patch
Size: 3518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230530/d9423a82/attachment.bin>


More information about the llvm-commits mailing list