[lld] r287938 - [ELF] Add explicit template instantiations for toString

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 29 08:48:13 PST 2016


Ah, I'm a bit confused about what's going on in this file - could you help
me understand why there are so many explicit template instantiations,
rather than the usual expectation that templates are defined in the header
and implicitly instantiated?

Is there some particular issue with implicit instantiations that's being
avoided here?

On Mon, Nov 28, 2016 at 11:41 PM Evgeny Leviant <eleviant at accesssoftek.com>
wrote:

> If you use toString<ELFT> *after* compiler sees the definition then no.
> ------------------------------
> *От:* David Blaikie <dblaikie at gmail.com>
> *Отправлено:* 28 ноября 2016 г. 21:24
>
> *Кому:* Evgeny Leviant; llvm-commits at lists.llvm.org
> *Тема:* Re: [lld] r287938 - [ELF] Add explicit template instantiations
> for toString
> Weird - wouldn't that have caused a failure at link time due to missing
> symbols?
>
> On Mon, Nov 28, 2016 at 10:14 AM Evgeny Leviant <eleviant at accesssoftek.com>
> wrote:
>
> They are defined in InputSection.h since r287787. They didn't have
> explicit instantiations initialy which, I guess, is because they weren't
> used anywhere, except InputSection.cpp.
> ------------------------------
> *От:* David Blaikie <dblaikie at gmail.com>
> *Отправлено:* 28 ноября 2016 г. 20:48
> *Кому:* Evgeny Leviant; llvm-commits at lists.llvm.org
> *Тема:* Re: [lld] r287938 - [ELF] Add explicit template instantiations
> for toString
>
> Are there extern template declarations in a header somewhere? (usually I'd
> expect to see them committed as a matched pair)
>
> On Fri, Nov 25, 2016 at 8:52 AM Eugene Leviant via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
> Author: evgeny777
> Date: Fri Nov 25 10:42:04 2016
> New Revision: 287938
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287938&view=rev
> Log:
> [ELF] Add explicit template instantiations for toString
>
> Modified:
>     lld/trunk/ELF/InputSection.cpp
>
> Modified: lld/trunk/ELF/InputSection.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=287938&r1=287937&r2=287938&view=diff
>
> ==============================================================================
> --- lld/trunk/ELF/InputSection.cpp (original)
> +++ lld/trunk/ELF/InputSection.cpp Fri Nov 25 10:42:04 2016
> @@ -823,3 +823,8 @@ template class elf::MergeInputSection<EL
>  template class elf::MergeInputSection<ELF32BE>;
>  template class elf::MergeInputSection<ELF64LE>;
>  template class elf::MergeInputSection<ELF64BE>;
> +
> +template std::string elf::toString(const InputSectionBase<ELF32LE> *);
> +template std::string elf::toString(const InputSectionBase<ELF32BE> *);
> +template std::string elf::toString(const InputSectionBase<ELF64LE> *);
> +template std::string elf::toString(const InputSectionBase<ELF64BE> *);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161129/57cb73cf/attachment.html>


More information about the llvm-commits mailing list