diff options
author | John McCall <rjmccall@apple.com> | 2013-02-19 01:57:35 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-02-19 01:57:35 +0000 |
commit | a880b19aa6ef1dc95936f5de052be7a7d6ee6814 (patch) | |
tree | 5bfc6bbc9923a73e72a917920105bf1fb1f91df1 /lib/AST/Decl.cpp | |
parent | 0b5a483c8f5d8563ebc6ad5e311f2fadb734058d (diff) |
Add support for -fvisibility-ms-compat.
We treat this as an alternative to -fvisibility=<?>
which changes the default value visibility to "hidden"
and the default type visibility to "default".
Expose a -cc1 option for changing the default type
visibility, repurposing -fvisibility as the default
value visibility option (also setting type visibility
from it in the absence of a specific option).
rdar://13079314
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175480 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 0183c0b59e..6e93dd6415 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -80,7 +80,9 @@ typedef NamedDecl::LinkageInfo LinkageInfo; /// Is the given declaration a "type" or a "value" for the purposes of /// visibility computation? static bool usesTypeVisibility(const NamedDecl *D) { - return isa<TypeDecl>(D) || isa<ClassTemplateDecl>(D); + return isa<TypeDecl>(D) || + isa<ClassTemplateDecl>(D) || + isa<ObjCInterfaceDecl>(D); } /// Return the explicit visibility of the given declaration. @@ -440,10 +442,15 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, // Add in global settings if the above didn't give us direct visibility. if (!LV.visibilityExplicit()) { - // FIXME: type visibility - LV.mergeVisibility(Context.getLangOpts().getVisibilityMode(), - /*explicit*/ false); - + // Use global type/value visibility as appropriate. + Visibility globalVisibility; + if (computation == LVForValue) { + globalVisibility = Context.getLangOpts().getValueVisibilityMode(); + } else { + assert(computation == LVForType); + globalVisibility = Context.getLangOpts().getTypeVisibilityMode(); + } + LV.mergeVisibility(globalVisibility, /*explicit*/ false); // If we're paying attention to global visibility, apply // -finline-visibility-hidden if this is an inline method. |