From f731332360f3601f3b73e00fe113d97a15037b47 Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Thu, 10 Jan 2013 16:43:14 -0600 Subject: [PATCH] Builder.branch will check if the basicblock has terminator when running in debug mode. --- llvm/core.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/llvm/core.py b/llvm/core.py index ba74ec2..3baae95 100644 --- a/llvm/core.py +++ b/llvm/core.py @@ -1865,6 +1865,8 @@ class Builder(object): def branch(self, bblk): check_is_basic_block(bblk) + for instr in self.basic_block.instructions: + assert not instr.is_terminator, "BasicBlock can only have one terminator" return _make_value(_core.LLVMBuildBr(self.ptr, bblk.ptr)) def cbranch(self, if_value, then_blk, else_blk):