From 5828ee7a2782301ef4a54b7277d6b39f928c288e Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 3 May 2010 21:39:56 +0000 Subject: 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 --- clang/lib/CodeGen/CGDecl.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/CodeGen/CGDecl.cpp') 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!"); -- cgit v1.2.3