diff --git a/src/mapleall/maple_ir/src/mir_pragma.cpp b/src/mapleall/maple_ir/src/mir_pragma.cpp index c438a6393fa0f4f37145ba1ff1e2e0af666c4280..666d1654132cc934d0f360b5aae2db454d575cc9 100644 --- a/src/mapleall/maple_ir/src/mir_pragma.cpp +++ b/src/mapleall/maple_ir/src/mir_pragma.cpp @@ -353,11 +353,12 @@ void MIRPragma::Dump(int indent) const { } LogInfo::MapleLogger() << GlobalTables::GetStrTable().GetStringFromStrIdx(strIdx) << " "; GStrIdx gStrIdx = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdx)->GetNameStrIdx(); + LogInfo::MapleLogger() << "<$" << GlobalTables::GetStrTable().GetStringFromStrIdx(gStrIdx) << "> "; if (tyIdxEx != 0u) { MIRType *typeEx = GlobalTables::GetTypeTable().GetTypeFromTyIdx(tyIdxEx); - LogInfo::MapleLogger() << "\"" << typeEx->GetMplTypeName() << "\" "; + LogInfo::MapleLogger() << " " << typeEx->GetMplTypeName() << " "; } - LogInfo::MapleLogger() << "<$" << GlobalTables::GetStrTable().GetStringFromStrIdx(gStrIdx) << "> {"; + LogInfo::MapleLogger() << "{"; for (size_t j = 0; j < elementVec.size(); ++j) { LogInfo::MapleLogger() << '\n'; PrintIndentation(indent + 1); diff --git a/src/mapleall/maple_ir/src/parser.cpp b/src/mapleall/maple_ir/src/parser.cpp index 6a05b3207f3e3f8e523f4fe6ecafb22e9d847114..ca5fab5fbf741cf69e7563667cf5d7d26a4107e3 100644 --- a/src/mapleall/maple_ir/src/parser.cpp +++ b/src/mapleall/maple_ir/src/parser.cpp @@ -507,7 +507,7 @@ bool MIRParser::ParsePragma(MIRStructType &type) { p->SetKind(it->second); if (tk == TK_param) { - tk = lexer.NextToken(); + lexer.NextToken(); p->SetParamNum(lexer.GetTheIntVal()); } tk = lexer.NextToken(); @@ -516,7 +516,7 @@ bool MIRParser::ParsePragma(MIRStructType &type) { return false; } p->SetStrIdx(GlobalTables::GetStrTable().GetOrCreateStrIdxFromName(lexer.GetName())); - tk = lexer.NextToken(); + lexer.NextToken(); TyIdx tyIdx; if (!ParseType(tyIdx)) { Error("parsing pragma error: wrong type "); @@ -525,8 +525,12 @@ bool MIRParser::ParsePragma(MIRStructType &type) { p->SetTyIdx(tyIdx); tk = lexer.GetTokenKind(); if (tk != TK_lbrace) { - Error("parsing pragma error: expecting { but get "); - return false; + TyIdx tyIdxEx; + if (!ParseType(tyIdxEx)) { + Error("parsing pragma error: wrong type "); + return false; + } + p->SetTyIdxEx(tyIdxEx); } tk = lexer.NextToken(); while (tk != TK_rbrace) { @@ -810,7 +814,7 @@ bool MIRParser::ParseStructType(TyIdx &styIdx) { if (styIdx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(styIdx); if (prevType->GetKind() != kTypeByName) { - ASSERT(prevType->GetKind() == kTypeStruct || prevType->GetKind() == kTypeStructIncomplete, + ASSERT(prevType->GetKind() == kTypeStruct || prevType->IsIncomplete(), "type kind should be consistent."); if (static_cast(prevType)->IsIncomplete() && !(structType.IsIncomplete())) { structType.SetNameStrIdx(prevType->GetNameStrIdx()); @@ -847,7 +851,7 @@ bool MIRParser::ParseClassType(TyIdx &styidx) { prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(styidx); } if (prevType != nullptr && prevType->GetKind() != kTypeByName) { - ASSERT(prevType->GetKind() == kTypeClass || prevType->GetKind() == kTypeClassIncomplete, + ASSERT(prevType->GetKind() == kTypeClass || prevType->IsIncomplete(), "type kind should be consistent."); if (static_cast(prevType)->IsIncomplete() && !(classType.IsIncomplete())) { classType.SetNameStrIdx(prevType->GetNameStrIdx()); @@ -890,7 +894,7 @@ bool MIRParser::ParseInterfaceType(TyIdx &sTyIdx) { } if (sTyIdx != 0u) { MIRType *prevType = GlobalTables::GetTypeTable().GetTypeFromTyIdx(sTyIdx); - ASSERT(prevType->GetKind() == kTypeInterface || prevType->GetKind() == kTypeInterfaceIncomplete, + ASSERT(prevType->GetKind() == kTypeInterface || prevType->IsIncomplete(), "type kind should be consistent."); if (static_cast(prevType)->IsIncomplete() && !(interfaceType.IsIncomplete())) { interfaceType.SetNameStrIdx(prevType->GetNameStrIdx());