aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-04-13 18:44:05 +0000
committerJohn McCall <rjmccall@apple.com>2012-04-13 18:44:05 +0000
commit38baeabb253f3e04d5b54bf834dbd9f5ebdc9e5c (patch)
tree0dfea5d768804337cc4514c616ab9699519e2012 /lib/CodeGen/CGDecl.cpp
parent653b7cff0efe0d32ab12535846196e3465445fef (diff)
Don't enter cleanups for unreachable variables. It's impossible to
jump into these scopes, and the cleanup-entering code sometimes wants to do some operations first (e.g. a GEP), which can leave us with unparented IR. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154684 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 8c154f0708..644777963b 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -1171,6 +1171,10 @@ void CodeGenFunction::EmitAutoVarCleanups(const AutoVarEmission &emission) {
// If this was emitted as a global constant, we're done.
if (emission.wasEmittedAsGlobal()) return;
+ // If we don't have an insertion point, we're done. Sema prevents
+ // us from jumping into any of these scopes anyway.
+ if (!HaveInsertPoint()) return;
+
const VarDecl &D = *emission.Variable;
// Check the type for a cleanup.