forked from OSchip/llvm-project
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
This commit is contained in:
parent
c936b56871
commit
5828ee7a27
|
@ -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!");
|
||||
|
||||
|
|
|
@ -34,3 +34,14 @@ inline void h2() {
|
|||
void h3() {
|
||||
h2();
|
||||
}
|
||||
|
||||
// PR6980: this shouldn't crash
|
||||
namespace test0 {
|
||||
struct A { A(); };
|
||||
__attribute__((noreturn)) int throw_exception();
|
||||
|
||||
void test() {
|
||||
throw_exception();
|
||||
static A r;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue