From 2aa7acfadbfb840091e0cb49c0c704e5873a6647 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 4 Jan 2012 05:40:59 +0000 Subject: [PATCH] Process attributes in explicit function template instantiations. Fixes part of PR11690. llvm-svn: 147523 --- clang/lib/Sema/SemaTemplate.cpp | 3 +++ clang/test/CodeGenCXX/visibility.cpp | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index e90821e451fb..2527ac6a1cb2 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -6407,6 +6407,9 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, } Specialization->setTemplateSpecializationKind(TSK, D.getIdentifierLoc()); + AttributeList *Attr = D.getDeclSpec().getAttributes().getList(); + if (Attr) + ProcessDeclAttributeList(S, Specialization, Attr); if (TSK == TSK_ExplicitInstantiationDefinition) InstantiateFunctionDefinition(D.getIdentifierLoc(), Specialization); diff --git a/clang/test/CodeGenCXX/visibility.cpp b/clang/test/CodeGenCXX/visibility.cpp index 54dacac99950..7f48df3aaddf 100644 --- a/clang/test/CodeGenCXX/visibility.cpp +++ b/clang/test/CodeGenCXX/visibility.cpp @@ -475,4 +475,9 @@ namespace PR11690 { template class DEFAULT Class; // CHECK: define weak_odr void @_ZNK7PR116905ClassIcE4sizeEv // CHECK-HIDDEN: define weak_odr void @_ZNK7PR116905ClassIcE4sizeEv + + template void Method() {} + template __attribute__((visibility("default"))) void Method(); + // CHECK: define weak_odr void @_ZN7PR116906MethodIcEEvv + // CHECK-HIDDEN: define weak_odr void @_ZN7PR116906MethodIcEEvv }