-fmodules-codegen should not emit extern templates
authorLuboš Luňák <l.lunak@centrum.cz>
Sun, 3 Nov 2019 19:47:40 +0000 (20:47 +0100)
committerLuboš Luňák <l.lunak@centrum.cz>
Tue, 14 Jan 2020 22:39:50 +0000 (23:39 +0100)
commit729530f68fe135ad41d470fbed019cc5e31ac8a5
tree84ec84a0ee7baa437932dd9cef1c723bd67c80e8
parentf52d71736b10e87b1aa1880b777dc9462a0085ce
-fmodules-codegen should not emit extern templates

If a header contains 'extern template', then the template should be provided
somewhere by an explicit instantiation, so it is not necessary to generate
a copy. Worse, this can lead to an unresolved symbol, because the codegen's
object file will not actually contain functions from such a template
because of the GVA_AvailableExternally, but the object file for the explicit
instantiation will not contain them either because it will be blocked
by the information provided by the module.

Differential Revision: https://reviews.llvm.org/D69779
clang/lib/Serialization/ASTWriterDecl.cpp
clang/test/Modules/codegen-extern-template.cpp [new file with mode: 0644]
clang/test/Modules/codegen-extern-template.h [new file with mode: 0644]
clang/test/Modules/codegen-extern-template.modulemap [new file with mode: 0644]