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 | 8e7cb6dcfa1b6fe62097b5abd25611c99bdbcd6e (patch) | |
tree | 1f769e0f2f6da8b5cc4677e0e7d1a3821dec0a78 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | bba85850e3ad00aab0d2711ea0a5f85e377a760b (diff) | |
download | bcm5719-llvm-8e7cb6dcfa1b6fe62097b5abd25611c99bdbcd6e.tar.gz bcm5719-llvm-8e7cb6dcfa1b6fe62097b5abd25611c99bdbcd6e.zip |
Ensure that static local variables in function templates inherit the
visibility of their function.
llvm-svn: 118065
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index d975a22643c..a2b80bea6c0 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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); |