]> granicus.if.org Git - clang/commitdiff
Produce a hidden symbol for zed in
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 21 May 2012 20:15:56 +0000 (20:15 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 21 May 2012 20:15:56 +0000 (20:15 +0000)
  struct HIDDEN foo {
  };
  template <class P>
  struct bar {
  };
  template <>
  struct HIDDEN bar<foo> {
    DEFAULT static void zed();
  };
  void bar<foo>::zed() {
  }

Before we would produce a hidden symbol in

  struct HIDDEN foo {
  };
  template <class P>
  struct bar {
  };
  template <>
  struct bar<foo> {
    DEFAULT static void zed();
  };
  void bar<foo>::zed() {
  }

But adding HIDDEN to the specialization would cause us to produce a default
symbol.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157206 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp
test/CodeGenCXX/visibility.cpp

index d31cf0f010021b416f19b6f60fb5717cea531555..8bc9eb396e3499ad7f3013a689c0e72067ddf1a6 100644 (file)
@@ -163,7 +163,7 @@ static bool shouldConsiderTemplateLV(const FunctionDecl *fn) {
 }
 
 static bool shouldConsiderTemplateLV(const ClassTemplateSpecializationDecl *d) {
-  return !d->hasAttr<VisibilityAttr>();
+  return !d->hasAttr<VisibilityAttr>() || d->isExplicitSpecialization();
 }
 
 static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
index 568a2859f870a68bc66cd7e99bf83f32f98e72e8..be4348ee93f999bd3b4e770bca8a655ff7bdcd48 100644 (file)
@@ -789,3 +789,19 @@ namespace test39 {
   // GCC produces a default for this one. Why?
   // CHECK-HIDDEN: define weak_odr hidden void @_ZN6test391AINS_8hidden_tEE1BIS1_E4tempIS1_EEvv
 }
+
+namespace test42 {
+  struct HIDDEN foo {
+  };
+  template <class P>
+  struct bar {
+  };
+  template <>
+  struct HIDDEN bar<foo> {
+    DEFAULT static void zed();
+  };
+  void bar<foo>::zed() {
+  }
+  // CHECK: define hidden void @_ZN6test423barINS_3fooEE3zedEv
+  // CHECK-HIDDEN: define hidden void @_ZN6test423barINS_3fooEE3zedEv
+}