[clang] Unconditionally add autolink hints for frameworks.
authorJuergen Ributzka <juergen@ributzka.de>
Thu, 16 Mar 2023 22:28:48 +0000 (15:28 -0700)
committerJuergen Ributzka <juergen@ributzka.de>
Thu, 16 Mar 2023 22:31:17 +0000 (15:31 -0700)
commit29e2a4eff8f62d12754f31f90d70e9a346bc2075
tree94dd02c0852ba83a7769026feeb2d3a1dd8f6c90
parentf341d7a4091a6ec1c1a4a49c4810d4a8b036ad60
[clang] Unconditionally add autolink hints for frameworks.

Clang infers framework autolink hints when parsing a modulemap. In order to do
so, it checks if the module is a framework and if there is a framework binary
or TBD file in the SDK. Only when Clang finds the filei, then the autolink hint
is added to the module metadata.

During a project build many clang processes perform this check, which causes
many stat calls - even for modules/frameworks that are not even used.

The linker is already resilient to non-existing framework links that come from
the autolink metadata, so there is no need for Clang to do this check.

Instead the autolink hints are now added unconditionally and the linker only
needs to do the check once. This reduces the overall number of stat calls.

This fixes rdar://106578342.

Differential Revision: https://reviews.llvm.org/D146255
clang/lib/Lex/ModuleMap.cpp
clang/test/Modules/use-exportas-for-link.m