[PATCH] D69471: [Coverage] Revise format to reduce binary size
Duncan P. N. Exon Smith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 19 19:20:27 PST 2020
dexonsmith added a comment.
In D69471#1883912 <https://reviews.llvm.org/D69471#1883912>, @rnk wrote:
> Everything is off-by-one because the empty bases are not zero sized. The MSVC record layout algorithm is just different in this area. =/
Do all the MSVCs we support building with support `__declspec(empty_bases)`?
https://devblogs.microsoft.com/cppblog/optimizing-the-layout-of-empty-base-classes-in-vs2015-update-2-3/
> So, I think this patch would be fine if you refactor it to avoid the accessor classes. I took a stab at it, but it's not straightforward.
Another option is to chain the accessor classes:
template <class T, class Base = void> struct MyAccessor1 : Base { /* ... */ };
template <class T> struct MyAccessor1<void> { /* ... */ };
template <class T, class Base = void> struct MyAccessor2 : Base { /* ... */ };
template <class T> struct MyAccessor2<void> { /* ... */ };
Then you can:
struct MyFormat : MyAccessor1<MyFormat, MyAccessor2<MyFormat>> { /* ... */ };
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69471/new/
https://reviews.llvm.org/D69471
More information about the llvm-commits
mailing list