Ensure that static local variables in function templates inherit the
visibility of their function.
llvm-svn: 118065
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index b6c40b6..94c1f60 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1092,6 +1092,9 @@
// Create the guard variable.
llvm::SmallString<256> GuardVName;
getMangleContext().mangleItaniumGuardVariable(&D, GuardVName);
+
+ // FIXME: we should just absorb linkage and visibility from the
+ // variable, but that's not always set up properly just yet.
llvm::GlobalValue::LinkageTypes Linkage = GV->getLinkage();
if (D.isStaticDataMember() &&
D.getInstantiatedFromStaticDataMember())
@@ -1102,6 +1105,7 @@
false, Linkage,
llvm::ConstantInt::get(GuardTy, 0),
GuardVName.str());
+ GuardVariable->setVisibility(GV->getVisibility());
// Test whether the variable has completed initialization.
llvm::Value *IsInitialized;