Skip to content

Commit 4d1e4ef

Browse files
authored
[IR] Avoid call to deprecated PointerType::get (NFC) (llvm#134609)
Should keep MSVC quiet as noticed by @RKSimon in llvm#134517. Assertions have been copied over from PointerType::get in order to not silently change invariants with this call.
1 parent 37deb09 commit 4d1e4ef

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/include/llvm/IR/DerivedTypes.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,10 @@ class PointerType : public Type {
697697
[[deprecated("PointerType::getUnqual with pointee type is pending removal. "
698698
"Use Context overload.")]]
699699
static PointerType *getUnqual(Type *ElementType) {
700-
return PointerType::get(ElementType, 0);
700+
assert(ElementType && "Can't get a pointer to <null> type!");
701+
assert(isValidElementType(ElementType) &&
702+
"Invalid type for pointer element!");
703+
return PointerType::getUnqual(ElementType->getContext());
701704
}
702705

703706
/// This constructs an opaque pointer to an object in the

0 commit comments

Comments
 (0)