[PATCH] D138468: [ADT] Define None as std::nullopt (NFC)

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 22 09:57:29 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGabfe65a12b77: [ADT] Define None as std::nullopt (NFC) (authored by kazu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138468

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,11 +16,13 @@
 #ifndef LLVM_ADT_NONE_H
 #define LLVM_ADT_NONE_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.
-enum class NoneType { None };
-const NoneType None = NoneType::None;
+using NoneType = std::nullopt_t;
+inline constexpr std::nullopt_t None = std::nullopt;
 }
 
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138468.477239.patch
Type: text/x-patch
Size: 604 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221122/a73b3153/attachment.bin>


More information about the llvm-commits mailing list