summaryrefslogtreecommitdiffstats
path: root/clang/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
commit4a39ab80785e2c4ab63859a78ba58dfea2501216 (patch)
tree71444ec5848a54d39adde799ff07d17b7fdedcd7 /clang/lib/CodeGen/CGDecl.cpp
parent216c33bebaeca38dbf1dd98a7094875bf8ad78d1 (diff)
downloadbcm5719-llvm-4a39ab80785e2c4ab63859a78ba58dfea2501216.tar.gz
bcm5719-llvm-4a39ab80785e2c4ab63859a78ba58dfea2501216.zip
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. llvm-svn: 103052
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index ba3a2b47edb..48198ff5761 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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());
OpenPOWER on IntegriCloud