diff options
author | John McCall <rjmccall@apple.com> | 2010-05-04 20:45:42 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-05-04 20:45:42 +0000 |
commit | fe67f3bfc09caa66ab1398c03418c35bea77caf4 (patch) | |
tree | 958d625f437441ce64c4fac1ec9c43534361db92 /lib/CodeGen/CGDeclCXX.cpp | |
parent | 27b0f510d1d4f9ed5668eec1195f04b4a74a4426 (diff) |
Emit the globals, metadata, etc. associated with static variables even when
they're unreachable. This matters because (if they're POD, or if this is C)
the scope containing the variable might be reachable even if the variable
isn't. Fixes PR7044.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103052 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDeclCXX.cpp')
-rw-r--r-- | lib/CodeGen/CGDeclCXX.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDeclCXX.cpp b/lib/CodeGen/CGDeclCXX.cpp index f6c805fdca..6afa53868e 100644 --- a/lib/CodeGen/CGDeclCXX.cpp +++ b/lib/CodeGen/CGDeclCXX.cpp @@ -279,6 +279,9 @@ static llvm::Constant *getGuardAbortFn(CodeGenFunction &CGF) { void CodeGenFunction::EmitStaticCXXBlockVarDeclInit(const VarDecl &D, llvm::GlobalVariable *GV) { + // Bail out early if this initializer isn't reachable. + if (!Builder.GetInsertBlock()) return; + bool ThreadsafeStatics = getContext().getLangOptions().ThreadsafeStatics; llvm::SmallString<256> GuardVName; |