summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-05-03 21:39:56 +0000
committerJohn McCall <rjmccall@apple.com>2010-05-03 21:39:56 +0000
commit5828ee7a2782301ef4a54b7277d6b39f928c288e (patch)
tree038dcd7345fdc05bf33b00eb153f5d04677dc6a3 /clang/lib/CodeGen/CGDecl.cpp
parentc936b568719a9b59da368beaa941247b6d057f13 (diff)
downloadbcm5719-llvm-5828ee7a2782301ef4a54b7277d6b39f928c288e.tar.gz
bcm5719-llvm-5828ee7a2782301ef4a54b7277d6b39f928c288e.zip
Just bail out immediately when emitting an unreachable function-local static
variable. Surprisingly, this does seem to be the right way to solve this. llvm-svn: 102961
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 98a449ad764..244a5323d4b 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -231,6 +231,9 @@ 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!");
OpenPOWER on IntegriCloud