diff options
author | Mike Stump <mrs@apple.com> | 2009-02-07 20:09:00 +0000 |
---|---|---|
committer | Mike Stump <mrs@apple.com> | 2009-02-07 20:09:00 +0000 |
commit | 6d8a61747483e7736564e5defe46363313de9737 (patch) | |
tree | 7890c91d7963659ed1b3d745c638c463f12fc81d /clang/lib/CodeGen/CGObjC.cpp | |
parent | 7b7cec6895205be24268b256a0e812cfab999988 (diff) | |
download | bcm5719-llvm-6d8a61747483e7736564e5defe46363313de9737.tar.gz bcm5719-llvm-6d8a61747483e7736564e5defe46363313de9737.zip |
Ensure that we don't miscodegen if vlas creap into the top of the for.
This will allow us to generate break and continue even if vlas are
involved without worry that we'll silently generate bad code.
llvm-svn: 64028
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index d62cfdc3063..a116316641f 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -446,6 +446,10 @@ 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); @@ -515,6 +519,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); EmitStmt(S.getBody()); |