[libcxx-commits] [libcxx] [libc++] Introduce implicit and explicit ABI annotations (PR #193045)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 11 02:12:05 PDT 2026


philnik777 wrote:

> Thank you, @ldionne ! I've done some investigations of the regressions on our end, and so far I think the patch is basically WAI -- it does increase the SLoc pressure when Clang header modules are used, which brings some of the larger targets over the edge.
> 
> For example, for a particular large source file (with 4158 transitive includes, which would result in _LIBCPP_BEGIN_NAMESPACE_STD being expanded 942 times for "regular" non-modules build):
> 
>     * the number of loaded SLoc entries is increased by **~360K** (across all loaded `.pcm` files, each of which has many copies of newly added macro, which expands and eats up several SLoc entries).
> 
>     * the loaded SLoc space is increased by **~17.20MB** - which is a reasonable ~48 bytes per macro SLoc entry, and accounts for **~0.8%** increase of the loaded SLoc space. This increase, however, brings the total space used over the 2^31 limit.
> 
> 
> I'll follow up and share how pervasive this issue is across the codebase, and whether we'd be able to selectively disable header modules for too large targets to update the libc++.

> From my understanding -- and please correct me if I'm wrong -- you plan to follow up this change with updates that would
> 
>     * mostly remove `_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS` / `_LIBCPP_END_EXPLICIT_ABI_ANNOTATIONS` added to most files;

I don't think that will happen. Every single explicit range is required. We'll probably decrease the scope of them, but the number will most likely only increase.

>     * mostly remove `_LIBCPP_HIDE_FROM_ABI` from declarations, relying on implicit annotations created by `_LIBCPP_BEGIN_UNVERSIONED_NAMESPACE_STD`.

That is the plan. Given the 86 `_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS` out of 992 `_LIBCPP_BEGIN_NAMESPACE_STD`, we should be able to remove annotations from roughly 90% of the headers.

> 
> Both of this should, conversely, reduce the amount of macro expansions and SLoc pressure for Clang header module builds.

How do you measure the number of SLocs used?

https://github.com/llvm/llvm-project/pull/193045


More information about the libcxx-commits mailing list