summaryrefslogtreecommitdiffstats
path: root/clang/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
commit8c38d35b058c11c72951e7d71de268738853c682 (patch)
tree86f1a59ed157e54b11f792f48c8b9b8134d45040 /clang/lib/CodeGen/CGDecl.cpp
parentcbbdaa9378c568c983a476b3e527557a4c76aa69 (diff)
downloadbcm5719-llvm-8c38d35b058c11c72951e7d71de268738853c682.tar.gz
bcm5719-llvm-8c38d35b058c11c72951e7d71de268738853c682.zip
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. llvm-svn: 154684
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 8c154f07084..644777963b2 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud