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/CGDecl.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/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index e381e979470..5ac8508375f 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -172,6 +172,8 @@ CodeGenFunction::CreateStaticVarDecl(const VarDecl &D, CGM.EmitNullConstant(D.getType()), Name, 0, D.isThreadSpecified(), Ty.getAddressSpace()); GV->setAlignment(getContext().getDeclAlign(&D).getQuantity()); + if (Linkage != llvm::GlobalValue::InternalLinkage) + GV->setVisibility(CurFn->getVisibility()); return GV; } @@ -209,8 +211,10 @@ CodeGenFunction::AddInitializerToStaticVarDecl(const VarDecl &D, GV = new llvm::GlobalVariable(CGM.getModule(), Init->getType(), OldGV->isConstant(), OldGV->getLinkage(), Init, "", - 0, D.isThreadSpecified(), + /*InsertBefore*/ OldGV, + D.isThreadSpecified(), D.getType().getAddressSpace()); + GV->setVisibility(OldGV->getVisibility()); // Steal the name of the old global GV->takeName(OldGV); |