From 518a193da5529d4f209a7b5a1fe0f18081eee585 Mon Sep 17 00:00:00 2001 From: "jh9216.park" Date: Wed, 13 Jul 2022 19:21:51 -0400 Subject: [PATCH] Remove useless code - There is no sync method or delegate type in group mode, we don't need to consider them Change-Id: I6c2b39851acc4dd6b2c84300e3d1c98e820bc519 Signed-off-by: jh9216.park --- idlc/gen_cion/cpp_cion_group_body_gen.cc | 30 ++++++------------------------ idlc/gen_cion/cpp_cion_group_body_gen_cb.h | 7 ------- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/idlc/gen_cion/cpp_cion_group_body_gen.cc b/idlc/gen_cion/cpp_cion_group_body_gen.cc index 0c2748b..e497b1a 100644 --- a/idlc/gen_cion/cpp_cion_group_body_gen.cc +++ b/idlc/gen_cion/cpp_cion_group_body_gen.cc @@ -125,9 +125,6 @@ void CppCionGroupBodyGen::GenCionPayloadReceivedEvent(std::ofstream& stream, }); for (const auto& i : iface.GetDeclarations()) { - if (i->GetMethodType() == Declaration::MethodType::DELEGATE || - i->GetMethodType() == Declaration::MethodType::SYNC) - continue; stream << Tab(2) << "case static_cast(MethodId::" << i->GetID() << "): "; GenBrace(stream, TAB_SIZE * 2, [&]() { @@ -170,9 +167,6 @@ void CppCionGroupBodyGen::GenMethods(std::ofstream& stream, auto& decls = iface.GetDeclarations(); for (const auto& i : decls) { - if (i->GetMethodType() == Declaration::MethodType::DELEGATE) - continue; - GenDeclaration(stream, iface, *i); GenBrace(stream, 0, [&]() { GenInvocation(stream, *i); @@ -190,13 +184,9 @@ void CppCionGroupBodyGen::GenInvocation(std::ofstream& stream, << "rpc_port_parcel_write_int32(p, static_cast(MethodId::" << decl.GetID() << "));" << NLine(1); std::string m; - std::string l; for (const auto& i : decl.GetParameters()) { auto& pt = i->GetParameterType(); m += ConvertTypeToSerializer(pt.GetBaseType(), i->GetID(), "p"); - if (IsDelegateType(pt.GetBaseType())) { - l += "delegate_list_.emplace_back(" + i->GetID() + ".release());\n"; - } } stream << AddIndent(TAB_SIZE, m) << NLine(1); @@ -204,23 +194,15 @@ void CppCionGroupBodyGen::GenInvocation(std::ofstream& stream, GenBrace(stream, TAB_SIZE, [&]() { stream << Tab(2) << "std::lock_guard lock(mutex_);" << NLine(2); - if (!l.empty()) - stream << AddIndent(TAB_SIZE * 2, l); - else if (decl.GetMethodType() == Declaration::MethodType::ASYNC) - stream << ReplaceAll(CB_INVOCATION_ASYNC_MID, { - { "", GetTransportable().Cpp().GenPayloadType() }, - { "", GetTransportable().Cpp().GenGroupPublish() } - }) << NLine(1); + stream << ReplaceAll(CB_INVOCATION_ASYNC_MID, { + { "", GetTransportable().Cpp().GenPayloadType() }, + { "", GetTransportable().Cpp().GenGroupPublish() } + }) << NLine(1); }, false, false); stream << " while (false);" << NLine(1); - if (decl.GetMethodType() == Declaration::MethodType::ASYNC) { - stream << Tab(1) << "rpc_port_parcel_destroy(p);" - << NLine(1); - return; - } - - stream << CB_INVOCATION_END; + stream << Tab(1) << "rpc_port_parcel_destroy(p);" + << NLine(1); } } // namespace tidl diff --git a/idlc/gen_cion/cpp_cion_group_body_gen_cb.h b/idlc/gen_cion/cpp_cion_group_body_gen_cb.h index deb92ed..dfac993 100644 --- a/idlc/gen_cion/cpp_cion_group_body_gen_cb.h +++ b/idlc/gen_cion/cpp_cion_group_body_gen_cb.h @@ -46,13 +46,6 @@ R"__cpp_cb( )__cpp_cb"; -const char CB_INVOCATION_END[] = -R"__cpp_cb( - rpc_port_parcel_destroy(p); - - return ret; -)__cpp_cb"; - const char CB_GROUP_ON_PAYLOAD_RECEIVED_CB_FRONT[] = R"__cpp_cb( void ::OnPayloadReceivedCB(const peer_info, -- 2.7.4