[PATCH] D142989: [extract_symbols.py] Better handling of templates

John Brawn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 08:28:28 PST 2023


john.brawn created this revision.
john.brawn added reviewers: glandium, simon_tatham, miyuki.
Herald added a project: All.
john.brawn requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Since commit 846b676 <https://reviews.llvm.org/rG846b676766d8928249790cbb73f9fb4f1c4c8e0d> SmallVectorBase<uint32_t> has been explicitly instantiated, which means that clang.exe must export it for a plugin to be able to link against it, but the constructor is not exported as currently no template constructors or destructors are exported.

We can't just export all constructors and destructors, as that puts us over the symbol limit on Windows, so instead rewrite how we decide which templates need to be exported to be more precise. Currently we assume that templates instantiated many times have no explicit instantiations, but this isn't necessarily true and results also in exporting implicit template instantiations that we don't need to. Instead check for references to template members, as this indicates that the template must be explicitly instantiated (as if it weren't the template would just be implicitly instantiated on use).

Doing this also lets us get rid of the special-case handling of Type::getAs, as its explicit instantiations are now being detected as such.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142989

Files:
  llvm/utils/extract_symbols.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142989.493628.patch
Type: text/x-patch
Size: 12252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230131/e6c2cbc9/attachment.bin>


More information about the llvm-commits mailing list