Add FOLLY_MSVC_DECLSPEC and use it to enable EBO for f14 BasePolicy on MSVCnightly-2023.01.26
commit8aca5cdc36d1712e5bbd9a522a1433b56fafeb44
authorScott Wolchok <[email protected]>
Thu, 26 Jan 2023 01:01:51 +0000 (25 17:01 -0800)
committerFacebook GitHub Bot <[email protected]>
Thu, 26 Jan 2023 01:01:51 +0000 (25 17:01 -0800)
tree2b8909be88982c3e05b449de42a25ab623958059
parentfb521598a315f6c76f449dfdf19359b20109c0c9
Add FOLLY_MSVC_DECLSPEC and use it to enable EBO for f14 BasePolicy on MSVC

Summary:
Per https://learn.microsoft.com/en-us/cpp/cpp/empty-bases?view=msvc-170 (also linked in code comment), MSVC doesn't apply EBO for multiple inheritance by default. They can't fix it because it would be ABI-breaking, but they provided `__declspec(empty_bases)` as an opt-in.

This diff adds FOLLY_MSVC_DECLSPEC to pretty-up this `__declspec` and uses it to enable EBO for f14's BasePolicy, saving 8 bytes per F14 map on MSVC versions that support it.

Reviewed By: yfeldblum, ot

Differential Revision: D42597807

fbshipit-source-id: dbaadc5360fd2f535849a8a69a21abf95eee2859
third-party/folly/src/folly/CPortability.h
third-party/folly/src/folly/container/detail/F14Policy.h