[cfe-commits] r155316 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility.cpp

Rafael Espindola rafael.espindola at gmail.com
Sun Apr 22 08:31:59 PDT 2012


Author: rafael
Date: Sun Apr 22 10:31:59 2012
New Revision: 155316

URL: http://llvm.org/viewvc/llvm-project?rev=155316&view=rev
Log:
An attribute in a explicit template installation should take precedence over
the tempale arguments in deciding the visibility.

This agrees with gcc 4.7.

Found by trying to build chrome with component=shared_library with 155314
reverted.

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=155316&r1=155315&r2=155316&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sun Apr 22 10:31:59 2012
@@ -407,8 +407,8 @@
 
         // The arguments at which the template was instantiated.
         const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
-        LV.mergeWithMin(getLVForTemplateArgumentList(TemplateArgs,
-                                                     OnlyTemplate));
+        LV.merge(getLVForTemplateArgumentList(TemplateArgs,
+                                              OnlyTemplate));
       }
     }
 

Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=155316&r1=155315&r2=155316&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Sun Apr 22 10:31:59 2012
@@ -660,3 +660,16 @@
   // CHECK: define void @_ZN6test321A1B3bazEv
   // CHECK-HIDDEN: define void @_ZN6test321A1B3bazEv
 }
+
+namespace test33 {
+  template<typename T>
+  class foo {
+    void bar() {}
+    int a;
+  };
+  struct __attribute__((visibility("hidden"))) zed {
+  };
+  template class __attribute__((visibility("default"))) foo<zed>;
+  // CHECK: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv
+  // CHECK-HIDDEN: define weak_odr void @_ZN6test333fooINS_3zedEE3barEv
+}





More information about the cfe-commits mailing list