diff options
author | Mike Stump <mrs@apple.com> | 2009-02-07 23:02:10 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-02-07 23:02:10 +0000 |
commit | 3e9da66ac7e88d64d30ee777588677320660cf84 (patch) | |
tree | 3a6306abbd236f9ad372ed47347dba9ea19e358f /lib/CodeGen/CGObjC.cpp | |
parent | 043254a9d267d48f1289c3274fad0a17f97c435d (diff) |
Ensure we track all the stack depths for all break and continue points
correctly. This should lay the ground work to throw the big switch
and start code gening break and continue in the presense of vlas.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64046 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index a116316641..efd9299d1a 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -361,6 +361,11 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S) return; } + // We want to ensure that any vlas between here and when we + // push the break and continue context below can be destroyed + // when we break + llvm::Value *saveBreakStackDepth = StackDepth; + if (const DeclStmt *SD = dyn_cast<DeclStmt>(S.getElement())) { EmitStmt(SD); assert(HaveInsertPoint() && "DeclStmt destroyed insert point!"); @@ -446,10 +451,6 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S) llvm::BasicBlock *LoopStart = createBasicBlock("loopstart"); EmitBlock(LoopStart); - // We want to ensure there are no vlas between here and when we - // push the break and continue context below. - llvm::Value *saveStackDepth = StackDepth; - llvm::Value *CounterPtr = CreateTempAlloca(UnsignedLongLTy, "counter.ptr"); Builder.CreateStore(Zero, CounterPtr); @@ -519,9 +520,8 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S) llvm::BasicBlock *LoopEnd = createBasicBlock("loopend"); llvm::BasicBlock *AfterBody = createBasicBlock("afterbody"); - assert (StackDepth == saveStackDepth && "vla unhandled in for"); - - BreakContinuePush(LoopEnd, AfterBody); + // Ensure any vlas created between there and here, are undone + BreakContinuePush(LoopEnd, AfterBody, saveBreakStackDepth, StackDepth); EmitStmt(S.getBody()); |