[cfe-commits] r155098 - /cfe/trunk/lib/AST/Decl.cpp
Rafael Espindola
rafael.espindola at gmail.com
Wed Apr 18 19:55:01 PDT 2012
Author: rafael
Date: Wed Apr 18 21:55:01 2012
New Revision: 155098
URL: http://llvm.org/viewvc/llvm-project?rev=155098&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/Decl.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=155098&r1=155097&r2=155098&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Wed Apr 18 21:55:01 2012
@@ -271,7 +271,6 @@
// 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 @@
}
}
+ 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 @@
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 @@
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.
More information about the cfe-commits
mailing list