summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-04-19 02:55:01 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-04-19 02:55:01 +0000
commitaf690f509a9c16a9ab4be99208955c4a8ff255de (patch)
treed0ac1a41299bd29ae0b88fd30b138578093eb9fa /clang/lib/AST/Decl.cpp
parent7a5543dbfffa7fc3ada139e74ba7c48b853f921f (diff)
downloadbcm5719-llvm-af690f509a9c16a9ab4be99208955c4a8ff255de.tar.gz
bcm5719-llvm-af690f509a9c16a9ab4be99208955c4a8ff255de.zip
Move the point in the code where we handle -fvisibility=hidden. With
the current implementation this should be a nop as explicit visibility takes precedence in mergeVisibility. The location chosen is such that attributes checked above it can force a symbol to be default. For example, an attribute is the variable or function. Attributes checked after this point, can only make the visibility more restrictive. An attribute in a type for example. llvm-svn: 155098
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 2268f647990..12f8f7e0b17 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -271,7 +271,6 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
// scope and no storage-class specifier, its linkage is
// external.
LinkageInfo LV;
- LV.mergeVisibility(Context.getLangOpts().getVisibilityMode());
if (F.ConsiderVisibilityAttributes) {
if (llvm::Optional<Visibility> Vis = D->getExplicitVisibility()) {
@@ -292,6 +291,8 @@ static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVFlags F) {
}
}
+ LV.mergeVisibility(Context.getLangOpts().getVisibilityMode());
+
// C++ [basic.link]p4:
// A name having namespace scope has external linkage if it is the
@@ -482,7 +483,6 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, LVFlags F) {
return LinkageInfo::none();
LinkageInfo LV;
- LV.mergeVisibility(D->getASTContext().getLangOpts().getVisibilityMode());
bool DHasExplicitVisibility = false;
// If we have an explicit visibility attribute, merge that in.
@@ -536,6 +536,8 @@ static LinkageInfo getLVForClassMember(const NamedDecl *D, LVFlags F) {
if (LV.linkage() == UniqueExternalLinkage)
return LinkageInfo::uniqueExternal();
+ LV.mergeVisibility(D->getASTContext().getLangOpts().getVisibilityMode());
+
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(D)) {
// If the type of the function uses a type with unique-external
// linkage, it's not legally usable from outside this translation unit.
OpenPOWER on IntegriCloud