[llvm] 184591a - [OpaquePtrs] Deprecate PointerType::getElementType()
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 01:14:33 PST 2022
Author: Nikita Popov
Date: 2022-01-25T10:13:53+01:00
New Revision: 184591aeeb5a531f2315c3d7cddcd199c87ecb2c
URL: https://github.com/llvm/llvm-project/commit/184591aeeb5a531f2315c3d7cddcd199c87ecb2c
DIFF: https://github.com/llvm/llvm-project/commit/184591aeeb5a531f2315c3d7cddcd199c87ecb2c.diff
LOG: [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
Added:
Modified:
llvm/include/llvm/IR/DerivedTypes.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 8a1b26e699e32..f52ce3cde318d 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -667,9 +667,11 @@ class PointerType : public Type {
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;
More information about the llvm-commits
mailing list