diff options
author | John McCall <rjmccall@apple.com> | 2010-11-02 21:04:24 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-11-02 21:04:24 +0000 |
commit | 112c967bd5c862a0f5d7913aa06700c048807db8 (patch) | |
tree | fddf74a77ae45cd3dc3270e55c3ff26dfaf5b3e5 /lib/CodeGen/CodeGenModule.cpp | |
parent | ca45da0c6da20d9c0c903370f99af5e9a186e0da (diff) |
Ensure that static local variables in function templates inherit the
visibility of their function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118065 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index d975a22643..a2b80bea6c 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -1344,9 +1344,16 @@ void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD) { Entry = NewFn; } + // We need to set linkage and visibility on the function before + // generating code for it because various parts of IR generation + // want to propagate this information down (e.g. to local static + // declarations). llvm::Function *Fn = cast<llvm::Function>(Entry); setFunctionLinkage(D, Fn); + // FIXME: this is redundant with part of SetFunctionDefinitionAttributes + setGlobalVisibility(Fn, D, /*ForDef*/ true); + CodeGenFunction(*this).GenerateCode(D, Fn); SetFunctionDefinitionAttributes(D, Fn); |