[clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496)
authorHans Wennborg <hans@hanshq.net>
Wed, 31 Oct 2018 08:38:48 +0000 (08:38 +0000)
committerHans Wennborg <hans@hanshq.net>
Wed, 31 Oct 2018 08:38:48 +0000 (08:38 +0000)
commit59f18f1b72941a347aaf7d8eef61f8e7dd9f241a
tree6dffe01f8f2eafbd1f97f32c805845da55af8171
parent315357facab6e7a6a0b8d2c8b24974c39d24a385
[clang-cl] Inherit dllexport to static locals also in template instantiations (PR39496)

In the course of D51340, @takuto.ikuta discovered that Clang fails to put
dllexport/import attributes on static locals during template instantiation.

For regular functions, this happens in Sema::FinalizeDeclaration(), however for
template instantiations we need to do something in or around
TemplateDeclInstantiator::VisitVarDecl(). This patch does that, and extracts
the code to a utility function.

Differential Revision: https://reviews.llvm.org/D53870

llvm-svn: 345699
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/test/CodeGenCXX/dllexport.cpp
clang/test/CodeGenCXX/dllimport.cpp