aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-04 20:45:42 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-04 20:45:42 +0000
commitfe67f3bfc09caa66ab1398c03418c35bea77caf4 (patch)
tree958d625f437441ce64c4fac1ec9c43534361db92 /lib/CodeGen/CGDecl.cpp
parent27b0f510d1d4f9ed5668eec1195f04b4a74a4426 (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/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index ba3a2b47ed..48198ff576 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -231,9 +231,6 @@ CodeGenFunction::AddInitializerToGlobalBlockVarDecl(const VarDecl &D,
void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D,
llvm::GlobalValue::LinkageTypes Linkage) {
- // Bail out early if the block is unreachable.
- if (!Builder.GetInsertBlock()) return;
-
llvm::Value *&DMEntry = LocalDeclMap[&D];
assert(DMEntry == 0 && "Decl already exists in localdeclmap!");
@@ -245,9 +242,9 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D,
if (getContext().getLangOptions().CPlusPlus)
CGM.setStaticLocalDeclAddress(&D, GV);
+ // We can't have a VLA here, but we can have a pointer to a VLA,
+ // even though that doesn't really make any sense.
// Make sure to evaluate VLA bounds now so that we have them for later.
- //
- // FIXME: Can this happen?
if (D.getType()->isVariablyModifiedType())
EmitVLASize(D.getType());