Fix tdd&ut testcases

Signed-off-by: hufeng <hufeng20@huawei.com>
Change-Id: Ib66ffc90508a77b3db1c31a4f39b0efaac91d63e
This commit is contained in:
hufeng 2024-04-04 01:07:23 +08:00
parent bf642a6be1
commit 1a173e4ea4
4 changed files with 16 additions and 16 deletions

View File

@ -1401,7 +1401,7 @@ bool AsmEmitter::EmitPrograms(const std::string &filename, const std::vector<Pro
MakeConcurrentModuleRequestsAnnotation(prog);
}
ItemContainer::InitApi(api);
ItemContainer::SetApi(api);
auto items = ItemContainer {};
auto primitive_types = CreatePrimitiveTypes(&items);
auto entities = AsmEmitter::AsmEntityCollections {};
@ -1478,7 +1478,7 @@ bool AsmEmitter::Emit(Writer *writer, const Program &program, std::map<std::stri
PandaFileToPandaAsmMaps *maps, bool debug_info,
panda::panda_file::pgo::ProfileOptimizer *profile_opt, uint8_t api)
{
ItemContainer::InitApi(api);
ItemContainer::SetApi(api);
auto items = ItemContainer {};
if (!Emit(&items, program, maps, debug_info, profile_opt)) {
return false;
@ -1506,7 +1506,7 @@ bool AsmEmitter::Emit(const std::string &filename, const Program &program, std::
std::unique_ptr<const panda_file::File> AsmEmitter::Emit(const Program &program, PandaFileToPandaAsmMaps *maps,
uint8_t api)
{
ItemContainer::InitApi(api);
ItemContainer::SetApi(api);
auto items = ItemContainer {};
if (!Emit(&items, program, maps)) {
return nullptr;

View File

@ -165,7 +165,7 @@ static T *GetOrInsert(C &map, I &items, const P &pos, const E &key, bool is_fore
}
/*static*/
uint8_t ItemContainer::api = 0;
uint8_t ItemContainer::apiVersion = 0;
ItemContainer::ItemContainer()
{
@ -621,8 +621,8 @@ bool ItemContainer::WriteHeader(Writer *writer, ssize_t *checksum_offset)
}
writer->CountChecksum(true);
const auto write_version = GetVersionByApi(ItemContainer::GetApi());
std::vector<uint8_t> versionVec(std::begin(write_version.value()), std::end(write_version.value()));
const auto bc_version = GetVersionByApi(ItemContainer::GetApi());
std::vector<uint8_t> versionVec(std::begin(bc_version.value()), std::end(bc_version.value()));
if (!writer->WriteBytes(versionVec)) {
return false;

View File

@ -209,17 +209,17 @@ public:
indexed_item_count_++;
}
static void InitApi(uint8_t api)
static void SetApi(uint8_t api)
{
ItemContainer::api = api;
ItemContainer::apiVersion = api;
}
static uint8_t GetApi()
{
return ItemContainer::api;
return ItemContainer::apiVersion;
}
static uint8_t api;
static uint8_t apiVersion;
private:
template <class T>
@ -242,8 +242,8 @@ private:
{
ASSERT(type_ != IndexType::NONE);
const auto version = GetVersionByApi(ItemContainer::GetApi());
if (version.value().front() >= API_12 && (type == IndexType::FIELD || type == IndexType::PROTO)) {
const auto bc_version = GetVersionByApi(ItemContainer::GetApi());
if (bc_version.value().front() >= API_12 && (type == IndexType::FIELD || type == IndexType::PROTO)) {
SetNeedsEmit(false);
}
}

View File

@ -502,8 +502,8 @@ ProtoItem::ProtoItem(TypeItem *ret_type, const std::vector<MethodParamItem> &par
AddType(p.GetType(), &n);
}
const auto version = GetVersionByApi(ItemContainer::GetApi());
if (version.value().front() >= API_12) {
const auto bc_version = GetVersionByApi(ItemContainer::GetApi());
if (bc_version.value().front() >= API_12) {
// no need to emit protoItem
SetNeedsEmit(false);
}
@ -575,8 +575,8 @@ bool BaseMethodItem::Write(Writer *writer)
return false;
}
const auto version = GetVersionByApi(ItemContainer::GetApi());
if (version.value().front() >= API_12) {
const auto bc_version = GetVersionByApi(ItemContainer::GetApi());
if (bc_version.value().front() >= API_12) {
// reserve [proto_idx] field, write invalid index
if (!writer->Write<uint16_t>(INVALID_INDEX_16)) {
return false;