Don't emit implicit template instantiations eagerly (PR21718)
authorHans Wennborg <hans@hanshq.net>
Sat, 10 Jan 2015 01:19:48 +0000 (01:19 +0000)
committerHans Wennborg <hans@hanshq.net>
Sat, 10 Jan 2015 01:19:48 +0000 (01:19 +0000)
commit43a0f99b103dc9c2546e650b99f5501e49e74dd2
tree684a9d97c788f0d4ac39151128de445cd17530c4
parent7c8a7251162d7e5db51e3ff7350a186fc749cee6
Don't emit implicit template instantiations eagerly (PR21718)

Their linkage can change if they are later explicitly instantiated. We would
previously emit such functions eagerly (as opposed to lazily on first use) if
they have a 'dllexport' or 'used' attribute, and fail an assert when hitting the
explicit instantiation.

This is achieved by replacing the old CodeGenModule::MayDeferGeneration() method
with two new ones: MustBeEmitted() and MayBeEmittedEagerly().

Differential Revision: http://reviews.llvm.org/D6674

llvm-svn: 225570
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenModule.h
clang/test/CodeGenCXX/dllexport.cpp
clang/test/CodeGenCXX/explicit-instantiation.cpp