Skip to content

Commit 184591a

Browse files
committed
[OpaquePtrs] Deprecate PointerType::getElementType()
This deprecates PointerType::getElementType() in favor of Type::getPointerElementType(). The motivation is to make it more apparent when code accesses the pointer element type, because getElementType() may also also refer to at least ArrayType::getElementType() and VectorType::getElementType(). Differential Revision: https://reviews.llvm.org/D117885
1 parent 2248728 commit 184591a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/include/llvm/IR/DerivedTypes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,9 +667,11 @@ class PointerType : public Type {
667667
unsigned AddressSpace) {
668668
if (PT->isOpaque())
669669
return get(PT->getContext(), AddressSpace);
670-
return get(PT->getElementType(), AddressSpace);
670+
return get(PT->PointeeTy, AddressSpace);
671671
}
672672

673+
[[deprecated("Pointer element types are deprecated. You can *temporarily* "
674+
"use Type::getPointerElementType() instead")]]
673675
Type *getElementType() const {
674676
assert(!isOpaque() && "Attempting to get element type of opaque pointer");
675677
return PointeeTy;

0 commit comments

Comments
 (0)