[cfe-commits] r162360 - in /cfe/trunk: lib/Sema/SemaTemplate.cpp test/SemaCXX/pragma-visibility.cpp
Rafael Espindola
rafael.espindola at gmail.com
Wed Aug 22 07:52:15 PDT 2012
Author: rafael
Date: Wed Aug 22 09:52:14 2012
New Revision: 162360
URL: http://llvm.org/viewvc/llvm-project?rev=162360&view=rev
Log:
Merge existing attributes before processing pragmas in friend template
declarations.
Fixes pr13662.
Modified:
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/pragma-visibility.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=162360&r1=162359&r2=162360&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Wed Aug 22 09:52:14 2012
@@ -1104,6 +1104,9 @@
if (Attr)
ProcessDeclAttributeList(S, NewClass, Attr);
+ if (PrevClassTemplate)
+ mergeDeclAttributes(NewClass, PrevClassTemplate->getTemplatedDecl());
+
AddPushedVisibilityAttribute(NewClass);
if (TUK != TUK_Friend)
@@ -1138,8 +1141,6 @@
NewTemplate->setInvalidDecl();
NewClass->setInvalidDecl();
}
- if (PrevClassTemplate)
- mergeDeclAttributes(NewClass, PrevClassTemplate->getTemplatedDecl());
ActOnDocumentableDecl(NewTemplate);
Modified: cfe/trunk/test/SemaCXX/pragma-visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/pragma-visibility.cpp?rev=162360&r1=162359&r2=162360&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/pragma-visibility.cpp (original)
+++ cfe/trunk/test/SemaCXX/pragma-visibility.cpp Wed Aug 22 09:52:14 2012
@@ -21,3 +21,10 @@
#pragma GCC visibility push(protected)
#pragma GCC visibility pop
}
+
+namespace pr13662 {
+#pragma GCC visibility push(hidden)
+ template<class T> class __attribute__((__visibility__("default"))) foo;
+ class bar { template<class T> friend class foo; };
+#pragma GCC visibility pop
+}
More information about the cfe-commits
mailing list