This is an archive of the discontinued LLVM Phabricator instance.

[OpaquePtrs] Deprecate PointerType::getElementType()
ClosedPublic

Authored by nikic on Jan 21 2022, 5:30 AM.

Details

Reviewers
dblaikie
Group Reviewers
Restricted Project
Commits
rG184591aeeb5a: [OpaquePtrs] Deprecate PointerType::getElementType()
Summary

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().

Note that this is only a partial change -- if the general idea is agreeable, I'm going to convert uses of PointerType::getElementType() first, and then commit the actual deprecation as a separate change lateron. The current revision is just to give a general impression.

Depends on D117870.

Diff Detail

Event Timeline

nikic created this revision.Jan 21 2022, 5:30 AM
nikic requested review of this revision.Jan 21 2022, 5:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 21 2022, 5:30 AM

sounds good to me

Generally makes sense to me; staging you propose sounds right too.

Wondering though, why "deprecated" instead of simple delete? Either one is liable to need a temporary revert in downstreams... I figure, either they'll care about warnings (maybe use -Werror) and'll need to revert, or they won't care and this'll go by without being fixed. But I'm not sure / don't feel strongly / etc.

Generally makes sense to me; staging you propose sounds right too.

Wondering though, why "deprecated" instead of simple delete? Either one is liable to need a temporary revert in downstreams... I figure, either they'll care about warnings (maybe use -Werror) and'll need to revert, or they won't care and this'll go by without being fixed. But I'm not sure / don't feel strongly / etc.

Bit easier to disable the deprecation warning than revert the patch locally, perhaps. I think a deprecation's not a bad idea - and at least removing the function in a patch separately from the patch that removes all uses of it should make it easier for downstream folks.

(maybe even split this patch in two - one to add the new function, and another to deprecate the old one)

Generally makes sense to me; staging you propose sounds right too.

Wondering though, why "deprecated" instead of simple delete? Either one is liable to need a temporary revert in downstreams... I figure, either they'll care about warnings (maybe use -Werror) and'll need to revert, or they won't care and this'll go by without being fixed. But I'm not sure / don't feel strongly / etc.

I'd like to get this landed before the LLVM 14 branching, and I think it would be nice if the method is only deprecated in the release, so people don't have to scramble getting this resolved as part of the upgrade.

nikic updated this revision to Diff 402538.Jan 24 2022, 8:19 AM

Update more uses.

dblaikie accepted this revision.Jan 24 2022, 4:46 PM

Sounds good - though please separate it - API migration (one or many patches, I don't much mind) and then a separate one to flag the function as deprecated. (make it easier to revert if needed, or for downstream users to revert/#ifdef out/whatever they need to do)

This revision is now accepted and ready to land.Jan 24 2022, 4:46 PM

Generally makes sense to me; staging you propose sounds right too.

Wondering though, why "deprecated" instead of simple delete? Either one is liable to need a temporary revert in downstreams... I figure, either they'll care about warnings (maybe use -Werror) and'll need to revert, or they won't care and this'll go by without being fixed. But I'm not sure / don't feel strongly / etc.

I'd like to get this landed before the LLVM 14 branching, and I think it would be nice if the method is only deprecated in the release, so people don't have to scramble getting this resolved as part of the upgrade.

SG!

This revision was landed with ongoing or failed builds.Jan 25 2022, 1:14 AM
This revision was automatically updated to reflect the committed changes.