aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/Decl.h4
-rw-r--r--lib/AST/Decl.cpp2
2 files changed, 5 insertions, 1 deletions
diff --git a/include/clang/AST/Decl.h b/include/clang/AST/Decl.h
index 885286408b..0bf4615ca2 100644
--- a/include/clang/AST/Decl.h
+++ b/include/clang/AST/Decl.h
@@ -258,6 +258,10 @@ public:
// down to one of its members. If the member has no explicit visibility,
// the class visibility wins.
void mergeVisibility(Visibility V, bool E = false) {
+ // Never increase the visibility
+ if (visibility() < V)
+ return;
+
// If one has explicit visibility and the other doesn't, keep the
// explicit one.
if (visibilityExplicit() && !E)
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index f26747bdf6..f4c0aa3c6b 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -327,7 +327,7 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
LinkageInfo TypeLV = getLVForType(Var->getType());
if (TypeLV.linkage() != ExternalLinkage)
return LinkageInfo::uniqueExternal();
- LV.mergeVisibilityWithMin(TypeLV);
+ LV.mergeVisibility(TypeLV);
}
if (Var->getStorageClass() == SC_PrivateExtern)