[cfe-commits] r155301 - in /cfe/trunk: lib/AST/Decl.cpp test/CodeGenCXX/visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Sat Apr 21 17:43:48 PDT 2012
Author: rafael
Date: Sat Apr 21 19:43:48 2012
New Revision: 155301
URL: http://llvm.org/viewvc/llvm-project?rev=155301&view=rev
Log:
Fix handling of template parameters. Found by inspection. GCC 4.7 agrees
with this testcase.
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=155301&r1=155300&r2=155301&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sat Apr 21 19:43:48 2012
@@ -423,9 +423,7 @@
// - a template, unless it is a function template that has
// internal linkage (Clause 14);
} else if (const TemplateDecl *temp = dyn_cast<TemplateDecl>(D)) {
- if (!OnlyTemplate)
- LV.merge(getLVForTemplateParameterList(temp->getTemplateParameters()));
-
+ LV.merge(getLVForTemplateParameterList(temp->getTemplateParameters()));
// - a namespace (7.3), unless it is declared within an unnamed
// namespace.
} else if (isa<NamespaceDecl>(D) && !D->isInAnonymousNamespace()) {
Modified: cfe/trunk/test/CodeGenCXX/visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/visibility.cpp?rev=155301&r1=155300&r2=155301&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/visibility.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/visibility.cpp Sat Apr 21 19:43:48 2012
@@ -5,6 +5,20 @@
#define PROTECTED __attribute__((visibility("protected")))
#define DEFAULT __attribute__((visibility("default")))
+namespace test30 {
+ // When H is hidden, it should make X hidden, even if the template argument
+ // is not.
+ struct H {
+ };
+ template<H *T>
+ struct X {
+ };
+ H DEFAULT a;
+ X<&a> b;
+ // CHECK: _ZN6test301bE = global
+ // CHECK-HIDDEN: _ZN6test301bE = hidden global
+}
+
namespace test25 {
template<typename T>
struct X {
More information about the cfe-commits
mailing list