[llvm] 4d1e4ef - [IR] Avoid call to deprecated PointerType::get (NFC) (#134609)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 05:09:03 PDT 2025
Author: Mats Jun Larsen
Date: 2025-04-07T12:09:00Z
New Revision: 4d1e4eff5f6c6c62781926b0d31ad155364ffe62
URL: https://github.com/llvm/llvm-project/commit/4d1e4eff5f6c6c62781926b0d31ad155364ffe62
DIFF: https://github.com/llvm/llvm-project/commit/4d1e4eff5f6c6c62781926b0d31ad155364ffe62.diff
LOG: [IR] Avoid call to deprecated PointerType::get (NFC) (#134609)
Should keep MSVC quiet as noticed by @rksimon in #134517.
Assertions have been copied over from PointerType::get in order to not
silently change invariants with this call.
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 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 <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
More information about the llvm-commits
mailing list