Use new getLinkage() method to correctly compute whether a variable has

internal linkage.  Fixes PR5433.

llvm-svn: 89931
This commit is contained in:
Eli Friedman
2009-11-26 02:52:12 +00:00
parent abe274a8b0
commit 8a5f75ed5d
2 changed files with 11 additions and 4 deletions

View File

@@ -549,7 +549,7 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
// cannot be.
if (VD->isInAnonymousNamespace())
return true;
if (VD->getStorageClass() == VarDecl::Static) {
if (VD->getLinkage() == VarDecl::InternalLinkage) {
// Initializer has side effects?
if (VD->getInit() && VD->getInit()->HasSideEffects(Context))
return false;
@@ -982,9 +982,8 @@ GetLinkageForVariable(ASTContext &Context, const VarDecl *VD) {
return CodeGenModule::GVA_TemplateInstantiation;
}
}
// Static variables get internal linkage.
if (VD->getStorageClass() == VarDecl::Static)
if (VD->getLinkage() == VarDecl::InternalLinkage)
return CodeGenModule::GVA_Internal;
return CodeGenModule::GVA_StrongExternal;