aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-02-27 02:27:19 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-02-27 02:27:19 +0000
commit18895dc4fd29f0071eeb591be820338f16407906 (patch)
treecc6c32f8e7fa705d3932f28527a85526b06394fe /lib/AST/Decl.cpp
parent2beda12c3fbaa9125831b7f818680978c596b205 (diff)
Change Type::getLinkageAndVisibility to return a LinkageInfo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176157 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r--lib/AST/Decl.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index e4688f09a3..3553e0e2f3 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -211,11 +211,6 @@ static Optional<Visibility> getVisibilityOf(const NamedDecl *D,
return None;
}
-static LinkageInfo getLVForType(QualType T) {
- std::pair<Linkage,Visibility> P = T->getLinkageAndVisibility();
- return LinkageInfo(P.first, P.second, T->isVisibilityExplicit());
-}
-
/// \brief Get the most restrictive linkage for the types in the given
/// template parameter list. For visibility purposes, template
/// parameters are part of the signature of a template.
@@ -239,7 +234,7 @@ getLVForTemplateParameterList(const TemplateParameterList *params) {
// Handle the non-pack case first.
if (!NTTP->isExpandedParameterPack()) {
if (!NTTP->getType()->isDependentType()) {
- LV.merge(getLVForType(NTTP->getType()));
+ LV.merge(NTTP->getType()->getLinkageAndVisibility());
}
continue;
}
@@ -248,7 +243,7 @@ getLVForTemplateParameterList(const TemplateParameterList *params) {
for (unsigned i = 0, n = NTTP->getNumExpansionTypes(); i != n; ++i) {
QualType type = NTTP->getExpansionType(i);
if (!type->isDependentType())
- LV.merge(getLVForType(type));
+ LV.merge(type->getLinkageAndVisibility());
}
continue;
}
@@ -296,7 +291,7 @@ getLVForTemplateArgumentList(ArrayRef<TemplateArgument> args) {
continue;
case TemplateArgument::Type:
- LV.merge(getLVForType(arg.getAsType()));
+ LV.merge(arg.getAsType()->getLinkageAndVisibility());
continue;
case TemplateArgument::Declaration:
@@ -307,7 +302,7 @@ getLVForTemplateArgumentList(ArrayRef<TemplateArgument> args) {
continue;
case TemplateArgument::NullPtr:
- LV.merge(getLVForType(arg.getNullPtrType()));
+ LV.merge(arg.getNullPtrType()->getLinkageAndVisibility());
continue;
case TemplateArgument::Template:
@@ -627,7 +622,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D,
// because of this, but unique-external linkage suits us.
if (Context.getLangOpts().CPlusPlus &&
!Var->getDeclContext()->isExternCContext()) {
- LinkageInfo TypeLV = getLVForType(Var->getType());
+ LinkageInfo TypeLV = Var->getType()->getLinkageAndVisibility();
if (TypeLV.linkage() != ExternalLinkage)
return LinkageInfo::uniqueExternal();
if (!LV.visibilityExplicit())
@@ -819,7 +814,7 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D,
} else if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
// Modify the variable's linkage by its type, but ignore the
// type's visibility unless it's a definition.
- LinkageInfo typeLV = getLVForType(VD->getType());
+ LinkageInfo typeLV = VD->getType()->getLinkageAndVisibility();
LV.mergeMaybeWithVisibility(typeLV,
!LV.visibilityExplicit() && !classLV.visibilityExplicit());