[cfe-commits] r133182 - in /cfe/trunk/lib: AST/Decl.cpp CodeGen/CodeGenModule.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Jun 16 13:14:50 PDT 2011
Author: fjahanian
Date: Thu Jun 16 15:14:50 2011
New Revision: 133182
URL: http://llvm.org/viewvc/llvm-project?rev=133182&view=rev
Log:
Move computation of __private_extern__ visibilty to
getLVForNamespaceScopeDecl(). // rdar://9609649
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=133182&r1=133181&r2=133182&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Thu Jun 16 15:14:50 2011
@@ -231,6 +231,14 @@
if (!FoundExtern)
return LinkageInfo::internal();
}
+ if (Var->getStorageClass() == SC_None) {
+ const VarDecl *PrevVar = Var->getPreviousDeclaration();
+ for (; PrevVar; PrevVar = PrevVar->getPreviousDeclaration())
+ if (PrevVar->getStorageClass() == SC_PrivateExtern)
+ break;
+ if (PrevVar)
+ return PrevVar->getLinkageAndVisibility();
+ }
} else if (isa<FunctionDecl>(D) || isa<FunctionTemplateDecl>(D)) {
// C++ [temp]p4:
// A non-member function template can have internal linkage; any
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=133182&r1=133181&r2=133182&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jun 16 15:14:50 2011
@@ -206,17 +206,8 @@
// Set visibility for definitions.
NamedDecl::LinkageInfo LV = D->getLinkageAndVisibility();
- if (LV.visibilityExplicit() || !GV->hasAvailableExternallyLinkage()) {
- Visibility Vis = LV.visibility();
- if (Vis == DefaultVisibility)
- if (const VarDecl *VD = dyn_cast<VarDecl>(D))
- if (const VarDecl *Old = VD->getPreviousDeclaration()) {
- Visibility OldVis = Old->getLinkageAndVisibility().visibility();
- if (OldVis == HiddenVisibility)
- Vis = HiddenVisibility;
- }
- GV->setVisibility(GetLLVMVisibility(Vis));
- }
+ if (LV.visibilityExplicit() || !GV->hasAvailableExternallyLinkage())
+ GV->setVisibility(GetLLVMVisibility(LV.visibility()));
}
/// Set the symbol visibility of type information (vtable and RTTI)
More information about the cfe-commits
mailing list