Fix duplicate scope identifiers decoding (#5584)

Signed-off-by: Bartłomiej Chmiel <[email protected]>
Co-authored-by: Ryszard Rozak <[email protected]>
This commit is contained in:
Bartłomiej Chmiel
2024-11-04 06:06:15 -08:00
committed by GitHub
co-authored by Ryszard Rozak
parent b3348a38d0
commit 4e71f359bf
3 changed files with 15 additions and 12 deletions
+1 -12
View File
@@ -156,7 +156,6 @@ class EmitCSyms final : EmitCBaseVisitorConst {
}
static string scopeDecodeIdentifier(const string& scpname) {
string out = scpname;
string::size_type pos = string::npos;
// Remove hierarchy
@@ -172,17 +171,7 @@ class EmitCSyms final : EmitCBaseVisitorConst {
}
}
if (pos != std::string::npos) out.erase(0, pos + 1);
// Decode all escaped characters
while ((pos = out.find("__0")) != string::npos) {
unsigned int x;
std::stringstream ss;
ss << std::hex << out.substr(pos + 3, 2);
ss >> x;
out.replace(pos, 5, 1, (char)x);
}
return out;
return pos != string::npos ? scpname.substr(pos + 1) : scpname;
}
/// (scp, m_vpiScopeCandidates, m_scopeNames) -> m_scopeNames