[llvm] 2529de5 - [ADT] Deprecate ArrayRef(std::nullopt) (#146011)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 27 01:03:06 PDT 2025
Author: Kazu Hirata
Date: 2025-06-27T01:03:02-07:00
New Revision: 2529de5c935ad59e5f76d15890f857bf42817bc9
URL: https://github.com/llvm/llvm-project/commit/2529de5c935ad59e5f76d15890f857bf42817bc9
DIFF: https://github.com/llvm/llvm-project/commit/2529de5c935ad59e5f76d15890f857bf42817bc9.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/ADT/ArrayRef.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 892482d64e4a1..9305af8e40502 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -67,7 +67,8 @@ namespace llvm {
/*implicit*/ ArrayRef() = default;
/// Construct an empty ArrayRef from std::nullopt.
- /*implicit*/ ArrayRef(std::nullopt_t) {}
+ /*implicit*/ LLVM_DEPRECATED("Use {} or ArrayRef<T>() instead", "{}")
+ ArrayRef(std::nullopt_t) {}
/// Construct an ArrayRef from a single element.
/*implicit*/ ArrayRef(const T &OneElt LLVM_LIFETIME_BOUND)
More information about the llvm-commits
mailing list