Skip to content

Commit 2529de5

Browse files
[ADT] Deprecate ArrayRef(std::nullopt) (#146011)
Since the use of std::nullopt outside the context of std::optional is kind of abuse and not intuitive to new comers, this patch deprecates the constructor. All known uses within the LLVM codebase have been migrated to other constructors.
1 parent a40a4c5 commit 2529de5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

llvm/include/llvm/ADT/ArrayRef.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ namespace llvm {
6767
/*implicit*/ ArrayRef() = default;
6868

6969
/// Construct an empty ArrayRef from std::nullopt.
70-
/*implicit*/ ArrayRef(std::nullopt_t) {}
70+
/*implicit*/ LLVM_DEPRECATED("Use {} or ArrayRef<T>() instead", "{}")
71+
ArrayRef(std::nullopt_t) {}
7172

7273
/// Construct an ArrayRef from a single element.
7374
/*implicit*/ ArrayRef(const T &OneElt LLVM_LIFETIME_BOUND)

0 commit comments

Comments
 (0)