From 6f4ac4b18fdfc410b547c82457fd7b229e48ec16 Mon Sep 17 00:00:00 2001 From: John McCall Date: Wed, 27 Oct 2010 22:31:22 +0000 Subject: [PATCH] Don't override explicit visibility attributes on class members with type-based visibility. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117500 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/Decl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 9c7654b9cb..cb03ff50e2 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -419,9 +419,10 @@ static LVPair getLVForClassMember(const NamedDecl *D) { const VisibilityAttr *VA = D->getAttr(); if (VA) LV.second = minVisibility(LV.second, GetVisibilityFromAttr(VA)); - // If it's a value declaration, apply the LV from its type. + // If it's a value declaration and we don't have an explicit visibility + // attribute, apply the LV from its type. // See the comment about namespace-scope variable decls above. - if (isa(D)) { + if (!VA && isa(D)) { LVPair TypeLV = cast(D)->getType()->getLinkageAndVisibility(); if (TypeLV.first != ExternalLinkage) LV.first = minLinkage(LV.first, UniqueExternalLinkage); -- 2.40.0