Skip to content

Commit abba01a

Browse files
[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<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.
1 parent de252e7 commit abba01a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

llvm/include/llvm/ADT/PointerUnion.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,18 @@ class PointerUnion
147147
// isa<T>, cast<T> and the llvm::dyn_cast<T>
148148

149149
/// Test if the Union currently holds the type matching T.
150-
template <typename T> inline bool is() const { return isa<T>(*this); }
150+
template <typename T>
151+
[[deprecated("Use isa instead")]]
152+
inline bool is() const {
153+
return isa<T>(*this);
154+
}
151155

152156
/// Returns the value of the specified pointer type.
153157
///
154158
/// If the specified pointer type is incorrect, assert.
155-
template <typename T> inline T get() const {
159+
template <typename T>
160+
[[deprecated("Use cast instead")]]
161+
inline T get() const {
156162
assert(isa<T>(*this) && "Invalid accessor called");
157163
return cast<T>(*this);
158164
}

0 commit comments

Comments
 (0)