-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[ADT] Deprecate PointerUnion::{is,get} (NFC) #122623
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 PointerUnion::{is,get} (NFC) #122623
Conversation
@llvm/pr-subscribers-llvm-adt Author: Kazu Hirata (kazutakahirata) ChangesPointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with This patch actually deprecates them with LLVM_DEPRECATED. I'm not touching PointerUnion::dyn_cast for now because we have not Full diff: https://github.com/llvm/llvm-project/pull/122623.diff 1 Files Affected:
diff --git a/llvm/include/llvm/ADT/PointerUnion.h b/llvm/include/llvm/ADT/PointerUnion.h
index 7d4ed02b622626..ac733066a0ac82 100644
--- a/llvm/include/llvm/ADT/PointerUnion.h
+++ b/llvm/include/llvm/ADT/PointerUnion.h
@@ -147,12 +147,18 @@ class PointerUnion
// isa<T>, cast<T> and the llvm::dyn_cast<T>
/// Test if the Union currently holds the type matching T.
- template <typename T> inline bool is() const { return isa<T>(*this); }
+ template <typename T>
+ LLVM_DEPRECATED("Use isa instead", "isa")
+ inline bool is() const {
+ return isa<T>(*this);
+ }
/// Returns the value of the specified pointer type.
///
/// If the specified pointer type is incorrect, assert.
- template <typename T> inline T get() const {
+ template <typename T>
+ LLVM_DEPRECATED("Use cast instead", "cast")
+ inline T get() const {
assert(isa<T>(*this) && "Invalid accessor called");
return cast<T>(*this);
}
|
This PR needs to be merged after #122622. |
PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T> This patch actually deprecates them with LLVM_DEPRECATED. I'm not touching PointerUnion::dyn_cast for now because we have not migrated away from it yet.
3bc27e2
to
aec8e1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
PointerUnion::{is,get} have been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T> This patch actually deprecates them with [[deprecated]]. I'm not touching PointerUnion::dyn_cast for now because we have not migrated away from it yet.
llvm#122623)" This reverts commit abba01a.
llvm#122623)" This reverts commit abba01a. We will address these deprecations later once all the other failures are dealt with and Swift's release/6.2 starts converging. Right now they're just getting in the way.
[stable/20250402] Revert "[ADT] Deprecate PointerUnion::{is,get} (NFC) (llvm#122623)"
PointerUnion::{is,get} have been soft deprecated in PointerUnion.h:
// FIXME: Replace the uses of is(), get() and dyn_cast() with
// isa, cast and the llvm::dyn_cast
This patch actually deprecates them with [[deprecated]].
I'm not touching PointerUnion::dyn_cast for now because we have not
migrated away from it yet.