[llvm] bd6a170 - [ADT] Deprecate llvm::NoneType

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 23 16:33:16 PST 2022


Author: Kazu Hirata
Date: 2022-11-23T16:33:10-08:00
New Revision: bd6a17069da66938217d0606ae8e6571ccaefb0b

URL: https://github.com/llvm/llvm-project/commit/bd6a17069da66938217d0606ae8e6571ccaefb0b
DIFF: https://github.com/llvm/llvm-project/commit/bd6a17069da66938217d0606ae8e6571ccaefb0b.diff

LOG: [ADT] Deprecate llvm::NoneType

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

Differential Revision: https://reviews.llvm.org/D138623

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/None.h b/llvm/include/llvm/ADT/None.h
index 7202983642c6..e64d0cb760ff 100644
--- a/llvm/include/llvm/ADT/None.h
+++ b/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::nullopt_t instead", "std::nullopt_t")
+typedef std::nullopt_t NoneType;
 inline constexpr std::nullopt_t None = std::nullopt;
 }
 


        


More information about the llvm-commits mailing list