The C API function LLVMGetBasicBlockTerminator should return NULL when the basic block is not well-formed.