diff --git a/llvm/include/llvm/IR/DerivedTypes.h b/llvm/include/llvm/IR/DerivedTypes.h index ba5c41ff033f5..d0dffa9de616a 100644 --- a/llvm/include/llvm/IR/DerivedTypes.h +++ b/llvm/include/llvm/IR/DerivedTypes.h @@ -697,7 +697,10 @@ class PointerType : public Type { [[deprecated("PointerType::getUnqual with pointee type is pending removal. " "Use Context overload.")]] static PointerType *getUnqual(Type *ElementType) { - return PointerType::get(ElementType, 0); + assert(ElementType && "Can't get a pointer to type!"); + assert(isValidElementType(ElementType) && + "Invalid type for pointer element!"); + return PointerType::getUnqual(ElementType->getContext()); } /// This constructs an opaque pointer to an object in the