This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Disentangle the 3 implementations of type_info
ClosedPublic

Authored by ldionne on Feb 1 2019, 11:26 AM.

Details

Summary

We currently have effectively 3 implementations of type_info: one for
the Microsoft ABI, one that does not assume that there's a unique copy
of each RTTI in a progran, and one that assumes a unique copy.

Those 3 implementations are entangled into the same class with nested
ifdefs, which makes it very difficult to understand. Furthermore, the
benefit of doing this is rather small since the code that is duplicated
across implementations is just a couple of trivial lines.

This patch stamps out the 3 versions of type_info explicitly to increase
readability. It also explains what's going on with short comments, because
it's far from obvious.

Diff Detail

Event Timeline

ldionne created this revision.Feb 1 2019, 11:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2019, 11:27 AM

Note that this is just a code reorganization, there is no functionality change here.

mclow.lists accepted this revision.Feb 1 2019, 11:54 AM

This looks fine to me. It also looks (to me) that it will make applying https://wg21.link/P1328 cleaner (assuming it gets approved)

This revision is now accepted and ready to land.Feb 1 2019, 11:54 AM
ldionne changed the repository for this revision from rC Clang to rCXX libc++.Feb 1 2019, 11:59 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 1 2019, 12:00 PM