This is an archive of the discontinued LLVM Phabricator instance.

[clang] Replaced some manual pointer tagging with llvm::PointerIntPair.
ClosedPublic

Authored by haberman on Mar 18 2021, 12:41 PM.

Details

Summary

There is no functional change here (hence no new tests). The only change
is to replace a couple uintptr_t members with llvm::PointerIntPair<> to
clean up the code, making it more readable and less error prone.

This cleanup highlighted that the old code was effectively casting away
const. This is fixed by changing some function signatures.

Diff Detail

Event Timeline

haberman requested review of this revision.Mar 18 2021, 12:41 PM
haberman created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2021, 12:41 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rsmith accepted this revision.Mar 18 2021, 12:50 PM

Thanks! Do we need InitializedEntity::getDecl to return a pointer to non-const? Looks good assuming we do.

clang/include/clang/Sema/Initialization.h
189–190

Here and below, consider updating "the low[er] bit" to "the integer" or similar.

This revision is now accepted and ready to land.Mar 18 2021, 12:50 PM
haberman updated this revision to Diff 331679.Mar 18 2021, 1:40 PM

Updated comment "the low bit" -> "the integer".

haberman marked an inline comment as done.Mar 18 2021, 1:41 PM

Thanks! Do we need InitializedEntity::getDecl to return a pointer to non-const?

Yes, if I try to propagate const the change starts to snowball.

Harbormaster completed remote builds in B94548: Diff 331679.
haberman updated this revision to Diff 332405.Mar 22 2021, 12:59 PM

Updated change to reflect all diffs since main.

This revision was landed with ongoing or failed builds.Mar 22 2021, 2:14 PM
This revision was automatically updated to reflect the committed changes.