[cfe-commits] r147523 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/CodeGenCXX/visibility.cpp

Rafael Espindola rafael.espindola at gmail.com
Tue Jan 3 21:41:00 PST 2012


Author: rafael
Date: Tue Jan  3 23:40:59 2012
New Revision: 147523

URL: http://llvm.org/viewvc/llvm-project?rev=147523&view=rev
Log:
Process attributes in explicit function template instantiations. Fixes part of
PR11690.

Modified:
    cfe/trunk/lib/Sema/SemaTemplate.cpp
    cfe/trunk/test/CodeGenCXX/visibility.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=147523&r1=147522&r2=147523&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Tue Jan  3 23:40:59 2012
@@ -6407,6 +6407,9 @@
   }
 
   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);

Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=147523&r1=147522&r2=147523&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Tue Jan  3 23:40:59 2012
@@ -475,4 +475,9 @@
   template class DEFAULT Class<char>;
   // CHECK: define weak_odr void @_ZNK7PR116905ClassIcE4sizeEv
   // CHECK-HIDDEN: define weak_odr void @_ZNK7PR116905ClassIcE4sizeEv
+
+  template<class T> void Method() {}
+  template  __attribute__((visibility("default"))) void Method<char>();
+  // CHECK: define weak_odr void @_ZN7PR116906MethodIcEEvv
+  // CHECK-HIDDEN: define weak_odr void @_ZN7PR116906MethodIcEEvv
 }





More information about the cfe-commits mailing list