[cfe-commits] r160139 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Thu Jul 12 13:05:04 PDT 2012
Author: rafael
Date: Thu Jul 12 15:05:04 2012
New Revision: 160139
URL: http://llvm.org/viewvc/llvm-project?rev=160139&view=rev
Log:
Use the canonical template decl when trying to find if it has a visibility
attribute.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/CodeGenCXX/visibility.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=160139&r1=160138&r2=160139&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Jul 12 15:05:04 2012
@@ -702,8 +702,10 @@
// specialization of a class template, check for visibility
// on the pattern.
if (const ClassTemplateSpecializationDecl *spec
- = dyn_cast<ClassTemplateSpecializationDecl>(this))
- return getVisibilityOf(spec->getSpecializedTemplate()->getTemplatedDecl());
+ = dyn_cast<ClassTemplateSpecializationDecl>(this)) {
+ ClassTemplateDecl *TD = spec->getSpecializedTemplate()->getCanonicalDecl();
+ return getVisibilityOf(TD->getTemplatedDecl());
+ }
// If this is a member class of a specialization of a class template
// and the corresponding decl has explicit visibility, use that.
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=160139&r1=160138&r2=160139&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Thu Jul 12 15:05:04 2012
@@ -1018,3 +1018,16 @@
// CHECK: declare hidden void @_ZN6test543fooINS_3zedEE3barEv
// CHECK-HIDDEN: declare hidden void @_ZN6test543fooINS_3zedEE3barEv
}
+
+namespace test55 {
+ template <class T>
+ struct __attribute__((visibility("hidden"))) foo {
+ static void bar();
+ };
+ template <class T> struct foo;
+ void foobar() {
+ foo<int>::bar();
+ }
+ // CHECK: declare hidden void @_ZN6test553fooIiE3barEv
+ // CHECK-HIDDEN: declare hidden void @_ZN6test553fooIiE3barEv
+}
More information about the cfe-commits
mailing list