From d3a10b0a76badc77d4a5498b54554fc37efab9bc Mon Sep 17 00:00:00 2001 From: SaeHie Park Date: Wed, 28 Aug 2024 02:37:23 +0000 Subject: [PATCH] [luci/lang] Add extended buffer accessors in Module This will add extended buffer accessors in Module. ONE-DCO-1.0-Signed-off-by: SaeHie Park --- compiler/luci/lang/include/luci/IR/Module.h | 7 +++++++ compiler/luci/lang/src/Module.test.cpp | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/compiler/luci/lang/include/luci/IR/Module.h b/compiler/luci/lang/include/luci/IR/Module.h index 75cf67905e7..e04512fba91 100644 --- a/compiler/luci/lang/include/luci/IR/Module.h +++ b/compiler/luci/lang/include/luci/IR/Module.h @@ -60,6 +60,13 @@ class Module final // TODO provide graph accessor with a name +public: + void ext_buffer(bool set) { _ext_buffer = set; } + bool ext_buffer(void) const { return _ext_buffer; } + +private: + bool _ext_buffer = false; + public: void source_table(const std::map &table) { _source_table = table; } diff --git a/compiler/luci/lang/src/Module.test.cpp b/compiler/luci/lang/src/Module.test.cpp index a5973e52dad..bab667e33b6 100644 --- a/compiler/luci/lang/src/Module.test.cpp +++ b/compiler/luci/lang/src/Module.test.cpp @@ -58,6 +58,14 @@ TEST(ModuleTest, add_more) ASSERT_EQ(g3_ptr, m->graph(2)); } +TEST(ModuleTest, ext_buffer) +{ + auto m = luci::make_module(); + + m->ext_buffer(true); + ASSERT_TRUE(m->ext_buffer()); +} + TEST(ModuleTest, add_nullptr_NEG) { auto m = luci::make_module(); @@ -71,3 +79,10 @@ TEST(ModuleTest, graph_index_overflow_NEG) EXPECT_ANY_THROW(m->graph(100)); } + +TEST(ModuleTest, ext_buffer_NEG) +{ + auto m = luci::make_module(); + // NOTE how can we define negative test for ext_buffer? + ASSERT_FALSE(m->ext_buffer()); +}