[llvm] [ADT] Deprecate PointerUnion::{is,get} (NFC) (PR #122623)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 11 17:50:11 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-adt
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/122623.diff
1 Files Affected:
- (modified) llvm/include/llvm/ADT/PointerUnion.h (+8-2)
``````````diff
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);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/122623
More information about the llvm-commits
mailing list