[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
This commit is contained in:
Nikita Popov 2022-01-25 09:57:26 +01:00
parent 22487280dc
commit 184591aeeb
1 changed files with 3 additions and 1 deletions

View File

@ -667,9 +667,11 @@ public:
unsigned AddressSpace) {
if (PT->isOpaque())
return get(PT->getContext(), AddressSpace);
return get(PT->getElementType(), AddressSpace);
return get(PT->PointeeTy, AddressSpace);
}
[[deprecated("Pointer element types are deprecated. You can *temporarily* "
"use Type::getPointerElementType() instead")]]
Type *getElementType() const {
assert(!isOpaque() && "Attempting to get element type of opaque pointer");
return PointeeTy;