From 728e5820fff79456eb745a602e4b8bce91762a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=99=93=E4=BC=9F?= <39303645+Shixiaowei02@users.noreply.github.com> Date: Fri, 18 Sep 2020 13:35:20 +0800 Subject: [PATCH] add clear_blocks interface for flatbuffers view, test=develop (#4363) * add clear_blocks interface for flatbuffers view, test=develop * fix a bug, test=develop --- lite/model_parser/flatbuffers/program_desc.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lite/model_parser/flatbuffers/program_desc.h b/lite/model_parser/flatbuffers/program_desc.h index afe7611599..0535b7f527 100644 --- a/lite/model_parser/flatbuffers/program_desc.h +++ b/lite/model_parser/flatbuffers/program_desc.h @@ -79,6 +79,13 @@ class ProgramDescView : public ProgramDescAPI { return desc_->version()->version(); } + void ClearBlocks() override { + CHECK_EQ(BlocksSize(), 0u) << "For backward compatibility, in the " + "read-only flatbuffers version, this " + "interface degenerates to force the number " + "of blocks to be zero."; + } + proto::ProgramDesc const* raw_desc() const { return desc_; } const std::vector& buf() const { return buf_; } -- GitLab