[PATCH] D138623: [ADT] Deprecate llvm::NoneType

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 15:36:29 PST 2022


kazu created this revision.
Herald added a project: All.
kazu requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

I've migrated all known uses of NoneType to std::nullopt_t.  This
patch deprecates NoneType.

I'm using "typedef" instead of "using" because somehow
"[[deprecated]]" and "using" do not seem to get along.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138623

Files:
  llvm/include/llvm/ADT/None.h


Index: llvm/include/llvm/ADT/None.h
===================================================================
--- llvm/include/llvm/ADT/None.h
+++ llvm/include/llvm/ADT/None.h
@@ -16,12 +16,14 @@
 #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 Optional<T>
 /// and similar types without having to spell out the specialization's name.
-using NoneType = std::nullopt_t;
+LLVM_DEPRECATED("Use std::noneopt_t instead.", "std::nullopt_t")
+typedef std::nullopt_t NoneType;
 inline constexpr std::nullopt_t None = std::nullopt;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138623.477633.patch
Type: text/x-patch
Size: 662 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221123/431a1330/attachment.bin>


More information about the llvm-commits mailing list