diff options
author | Chris Lattner <sabre@nondot.org> | 2007-07-16 21:28:45 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-07-16 21:28:45 +0000 |
commit | da13870e99fe33934b2122f06528a5063f78ae4c (patch) | |
tree | b0537b65749c5d635a4f265a53f6ec306eaaea82 /CodeGen/CodeGenFunction.h | |
parent | f0fbcb356bc4eb5f6467dc4fc4bc447e9a630102 (diff) |
Implement break and continue. Patch by Anders Carlsson!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39927 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CodeGen/CodeGenFunction.h')
-rw-r--r-- | CodeGen/CodeGenFunction.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/CodeGen/CodeGenFunction.h b/CodeGen/CodeGenFunction.h index 7479743ec3..67cefc2714 100644 --- a/CodeGen/CodeGenFunction.h +++ b/CodeGen/CodeGenFunction.h @@ -15,6 +15,7 @@ #define CODEGEN_CODEGENFUNCTION_H #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/Support/LLVMBuilder.h" #include <vector> @@ -175,6 +176,18 @@ class CodeGenFunction { /// LabelMap - This keeps track of the LLVM basic block for each C label. llvm::DenseMap<const LabelStmt*, llvm::BasicBlock*> LabelMap; + + // BreakContinueStack - This keeps track of where break and continue + // statements should jump to. + struct BreakContinue { + BreakContinue(llvm::BasicBlock *bb, llvm::BasicBlock *cb) + : BreakBlock(bb), ContinueBlock(cb) {} + + llvm::BasicBlock *BreakBlock; + llvm::BasicBlock *ContinueBlock; + }; + llvm::SmallVector<BreakContinue, 8> BreakContinueStack; + public: CodeGenFunction(CodeGenModule &cgm); @@ -254,7 +267,9 @@ public: void EmitForStmt(const ForStmt &S); void EmitReturnStmt(const ReturnStmt &S); void EmitDeclStmt(const DeclStmt &S); - + void EmitBreakStmt(); + void EmitContinueStmt(); + //===--------------------------------------------------------------------===// // LValue Expression Emission //===--------------------------------------------------------------------===// |