]> granicus.if.org Git - clang/commitdiff
Don't override explicit visibility attributes on class members with
authorJohn McCall <rjmccall@apple.com>
Wed, 27 Oct 2010 22:31:22 +0000 (22:31 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 27 Oct 2010 22:31:22 +0000 (22:31 +0000)
type-based visibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117500 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp

index 9c7654b9cbe6a1c2922a7485fcbd2e5766a7ad08..cb03ff50e25b4e47ad1da90b771d44a26c549a93 100644 (file)
@@ -419,9 +419,10 @@ static LVPair getLVForClassMember(const NamedDecl *D) {
   const VisibilityAttr *VA = D->getAttr<VisibilityAttr>();
   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<ValueDecl>(D)) {
+  if (!VA && isa<ValueDecl>(D)) {
     LVPair TypeLV = cast<ValueDecl>(D)->getType()->getLinkageAndVisibility();
     if (TypeLV.first != ExternalLinkage)
       LV.first = minLinkage(LV.first, UniqueExternalLinkage);