diff options
author | Hans Wennborg <hans@hanshq.net> | 2018-10-31 08:38:48 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2018-10-31 08:38:48 +0000 |
commit | 59f18f1b72941a347aaf7d8eef61f8e7dd9f241a (patch) | |
tree | 6dffe01f8f2eafbd1f97f32c805845da55af8171 /clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | |
parent | 315357facab6e7a6a0b8d2c8b24974c39d24a385 (diff) | |
download | bcm5719-llvm-59f18f1b72941a347aaf7d8eef61f8e7dd9f241a.tar.gz bcm5719-llvm-59f18f1b72941a347aaf7d8eef61f8e7dd9f241a.zip |
[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
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 5f2b05c0893..1256a6bf5c2 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -728,6 +728,9 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D, D->getLocation(), D->getIdentifier(), DI->getType(), DI, D->getStorageClass()); + if (Var->isStaticLocal()) + SemaRef.CheckStaticLocalForDllExport(Var); + // In ARC, infer 'retaining' for variables of retainable type. if (SemaRef.getLangOpts().ObjCAutoRefCount && SemaRef.inferObjCARCLifetime(Var)) |