[llvm] [IR] Remove deprecated typed-pointer creation APIs (PR #212812)
Marc Auberer via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 29 09:26:51 PDT 2026
https://github.com/marcauberer created https://github.com/llvm/llvm-project/pull/212812
Removes `PointerType::get(Type*, unsigned)`, `PointerType::getUnqual(Type*)`, and `Type::getPointerTo(unsigned)`, the last typed-pointer-creation leftovers from the opaque pointers migration. All three have been marked deprecated for a while and have no remaining in-tree callers; every caller already uses the LLVMContext-taking overloads.
>From c5c4b8979bec25821339e9af787a9c794aac43af Mon Sep 17 00:00:00 2001
From: Claude <noreply at anthropic.com>
Date: Wed, 29 Jul 2026 16:15:03 +0000
Subject: [PATCH] [IR] Remove deprecated typed-pointer creation APIs
Removes PointerType::get(Type*, unsigned), PointerType::getUnqual(Type*),
and Type::getPointerTo(unsigned), the last typed-pointer-creation leftovers
from the opaque pointers migration. All three have been marked deprecated
for a while and have no remaining in-tree callers; every caller already
uses the LLVMContext-taking overloads.
Co-Authored-By: Claude Sonnet 5 <noreply at anthropic.com>
Claude-Session: https://claude.ai/code/session_01BhD3x7TrULk6CNeKi2FHVZ
---
llvm/include/llvm/IR/DerivedTypes.h | 16 ----------------
llvm/include/llvm/IR/Type.h | 6 ------
llvm/lib/IR/Type.cpp | 12 ------------
3 files changed, 34 deletions(-)
diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h
index 93ccd5944d432..572d0d5e9e5e4 100644
--- a/llvm/include/llvm/IR/DerivedTypes.h
+++ b/llvm/include/llvm/IR/DerivedTypes.h
@@ -762,26 +762,10 @@ class PointerType : public Type {
PointerType(const PointerType &) = delete;
PointerType &operator=(const PointerType &) = delete;
- /// This constructs a pointer to an object of the specified type in a numbered
- /// address space.
- [[deprecated("PointerType::get with pointee type is pending removal. Use "
- "Context overload.")]]
- LLVM_ABI static PointerType *get(Type *ElementType, unsigned AddressSpace);
/// This constructs an opaque pointer to an object in a numbered address
/// space.
LLVM_ABI static PointerType *get(LLVMContext &C, unsigned AddressSpace);
- /// This constructs a pointer to an object of the specified type in the
- /// default address space (address space zero).
- [[deprecated("PointerType::getUnqual with pointee type is pending removal. "
- "Use Context overload.")]]
- static PointerType *getUnqual(Type *ElementType) {
- assert(ElementType && "Can't get a pointer to <null> type!");
- assert(isValidElementType(ElementType) &&
- "Invalid type for pointer element!");
- return PointerType::getUnqual(ElementType->getContext());
- }
-
/// This constructs an opaque pointer to an object in the
/// default address space (address space zero).
static PointerType *getUnqual(LLVMContext &C) {
diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h
index eadadea56dc21..b0e949c118ce4 100644
--- a/llvm/include/llvm/IR/Type.h
+++ b/llvm/include/llvm/IR/Type.h
@@ -520,12 +520,6 @@ class Type {
LLVM_ABI static Type *getWasm_ExternrefTy(LLVMContext &C);
LLVM_ABI static Type *getWasm_FuncrefTy(LLVMContext &C);
- /// Return a pointer to the current type. This is equivalent to
- /// PointerType::get(Ctx, AddrSpace).
- /// TODO: Remove this after opaque pointer transition is complete.
- LLVM_ABI LLVM_DEPRECATED("Use PointerType::get instead", "PointerType::get")
- PointerType *getPointerTo(unsigned AddrSpace = 0) const;
-
private:
/// Derived types like structures and arrays are sized iff all of the members
/// of the type are sized as well. Since asking for their size is relatively
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 8c108a4d1f275..890f523b69f55 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -908,14 +908,6 @@ ScalableVectorType *ScalableVectorType::get(Type *ElementType,
// PointerType Implementation
//===----------------------------------------------------------------------===//
-PointerType *PointerType::get(Type *EltTy, unsigned AddressSpace) {
- assert(EltTy && "Can't get a pointer to <null> type!");
- assert(isValidElementType(EltTy) && "Invalid type for pointer element!");
-
- // Automatically convert typed pointers to opaque pointers.
- return get(EltTy->getContext(), AddressSpace);
-}
-
PointerType *PointerType::get(LLVMContext &C, unsigned AddressSpace) {
LLVMContextImpl *CImpl = C.pImpl;
@@ -933,10 +925,6 @@ PointerType::PointerType(LLVMContext &C, unsigned AddrSpace)
setSubclassData(AddrSpace);
}
-PointerType *Type::getPointerTo(unsigned AddrSpace) const {
- return PointerType::get(getContext(), AddrSpace);
-}
-
bool PointerType::isValidElementType(Type *ElemTy) {
return !ElemTy->isVoidTy() && !ElemTy->isLabelTy() &&
!ElemTy->isMetadataTy() && !ElemTy->isTokenTy() &&
More information about the llvm-commits
mailing list