Simplify linkage code for static local vars.

The key insight here is that weak linkage for a static local variable
should always mean linkonce_odr, because every file that needs it will
generate a definition.  We don't actually care about the precise linkage
of the parent context.  I feel a bit silly that I didn't realize this before.

llvm-svn: 185381
This commit is contained in:
Eli Friedman
2013-07-01 20:53:07 +00:00
parent 48fc20a034
commit c48d31c31c
4 changed files with 5 additions and 56 deletions

View File

@@ -515,11 +515,7 @@ void CodeGenModule::EmitCtorList(const CtorList &Fns, const char *GlobalName) {
llvm::GlobalValue::LinkageTypes
CodeGenModule::getFunctionLinkage(GlobalDecl GD) {
return getFunctionLinkage(cast<FunctionDecl>(GD.getDecl()));
}
llvm::GlobalValue::LinkageTypes
CodeGenModule::getFunctionLinkage(const FunctionDecl *D) {
const FunctionDecl *D = cast<FunctionDecl>(GD.getDecl());
GVALinkage Linkage = getContext().GetGVALinkageForFunction(D);
if (Linkage == GVA_Internal)