-
Notifications
You must be signed in to change notification settings - Fork 14.4k
[ADT] Deprecate ArrayRef(std::nullopt) #146011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADT] Deprecate ArrayRef(std::nullopt) #146011
Conversation
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.
@llvm/pr-subscribers-llvm-adt Author: Kazu Hirata (kazutakahirata) ChangesSince the use of std::nullopt outside the context of std::optional is Full diff: https://github.com/llvm/llvm-project/pull/146011.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 892482d64e4a1..7a228d9915cde 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -67,7 +67,7 @@ namespace llvm {
/*implicit*/ ArrayRef() = default;
/// Construct an empty ArrayRef from std::nullopt.
- /*implicit*/ ArrayRef(std::nullopt_t) {}
+ /*implicit*/ [[deprecated]] ArrayRef(std::nullopt_t) {}
/// Construct an ArrayRef from a single element.
/*implicit*/ ArrayRef(const T &OneElt LLVM_LIFETIME_BOUND)
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
This patch missed a few uses in MLIR and CIR as well, so those probably need updating @andykaylor @mmha |
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.
…6011 (llvm#146043) Clean-up some std::nullopt usages in FIR ops builder that triggers a deprecated warning after llvm#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.