summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-05-25 14:47:05 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-05-25 14:47:05 +0000
commit0cf10ac9abd09d38fc4b143f54e2917d8c1d0af6 (patch)
tree2bd23130e37d60f3193fabd365777dac0c876b6b /clang/lib/AST/Decl.cpp
parent4d71d0f9fae70806d77b38a85312554daaa2ecc5 (diff)
downloadbcm5719-llvm-0cf10ac9abd09d38fc4b143f54e2917d8c1d0af6.tar.gz
bcm5719-llvm-0cf10ac9abd09d38fc4b143f54e2917d8c1d0af6.zip
When ignoring visibility in an instantiation, still consider the linkage.
Similar fixes for function and member template to follow as I write the testcases. llvm-svn: 157470
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 7b7fa427624..979971c7c39 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -163,7 +163,8 @@ static bool shouldConsiderTemplateLV(const FunctionDecl *fn,
return !fn->hasAttr<VisibilityAttr>() || spec->isExplicitSpecialization();
}
-static bool shouldConsiderTemplateLV(const ClassTemplateSpecializationDecl *d) {
+static bool
+shouldConsiderTemplateVis(const ClassTemplateSpecializationDecl *d) {
return !d->hasAttr<VisibilityAttr>() || d->isExplicitSpecialization();
}
@@ -399,14 +400,19 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
// linkage of the template and template arguments.
if (const ClassTemplateSpecializationDecl *spec
= dyn_cast<ClassTemplateSpecializationDecl>(Tag)) {
- if (shouldConsiderTemplateLV(spec)) {
- // From the template.
- LV.merge(getLVForDecl(spec->getSpecializedTemplate(), true));
-
- // The arguments at which the template was instantiated.
- const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
- LV.mergeWithMin(getLVForTemplateArgumentList(TemplateArgs,
- OnlyTemplate));
+ // From the template.
+ LinkageInfo TempLV = getLVForDecl(spec->getSpecializedTemplate(), true);
+
+ // The arguments at which the template was instantiated.
+ const TemplateArgumentList &TemplateArgs = spec->getTemplateArgs();
+ LinkageInfo ArgsLV = getLVForTemplateArgumentList(TemplateArgs,
+ OnlyTemplate);
+ if (shouldConsiderTemplateVis(spec)) {
+ LV.merge(TempLV);
+ LV.mergeWithMin(ArgsLV);
+ } else {
+ LV.mergeLinkage(TempLV);
+ LV.mergeLinkage(ArgsLV);
}
}
@@ -540,7 +546,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, bool OnlyTemplate) {
} else if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
if (const ClassTemplateSpecializationDecl *spec
= dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
- if (shouldConsiderTemplateLV(spec)) {
+ if (shouldConsiderTemplateVis(spec)) {
// Merge template argument/parameter information for member
// class template specializations.
LV.mergeWithMin(getLVForTemplateArgumentList(spec->getTemplateArgs(),
OpenPOWER on IntegriCloud