mirror of
https://github.com/verilator/verilator.git
synced 2026-09-02 18:58:51 +02:00
+13
-15
@@ -152,25 +152,23 @@ class EmitCSyms final : EmitCBaseVisitorConst {
|
||||
|
||||
static string scopeDecodeIdentifier(const string& scpname) {
|
||||
string out = scpname;
|
||||
// Remove hierarchy
|
||||
string::size_type pos = out.rfind('.');
|
||||
string::size_type pos = string::npos;
|
||||
|
||||
// If there's more than one ident and an escape, find the true last ident
|
||||
if (pos != string::npos && scpname.find('\\') != string::npos) {
|
||||
size_t i = 0;
|
||||
// always makes progress
|
||||
while (i < scpname.length()) {
|
||||
if (scpname[i] == '\\') {
|
||||
while (i < scpname.length() && scpname[i] != ' ') ++i;
|
||||
++i; // Proc ' ', it should always be there. Then grab '.' on next cycle
|
||||
} else {
|
||||
while (i < scpname.length() && scpname[i] != '.') ++i;
|
||||
if (i < scpname.length()) { pos = i++; }
|
||||
}
|
||||
// Remove hierarchy
|
||||
size_t i = 0;
|
||||
// always makes progress
|
||||
while (i < scpname.length()) {
|
||||
if (scpname[i] == '\\') {
|
||||
while (i < scpname.length() && scpname[i] != ' ') ++i;
|
||||
++i; // Proc ' ', it should always be there. Then grab '.' on next cycle
|
||||
} else {
|
||||
while (i < scpname.length() && scpname[i] != '.') ++i;
|
||||
if (i < scpname.length()) pos = i++;
|
||||
}
|
||||
}
|
||||
|
||||
if (pos != std::string::npos) out.erase(0, pos + 1);
|
||||
|
||||
// Decode all escaped characters
|
||||
while ((pos = out.find("__0")) != string::npos) {
|
||||
unsigned int x;
|
||||
@@ -230,7 +228,7 @@ class EmitCSyms final : EmitCBaseVisitorConst {
|
||||
}
|
||||
// UINFO(9, "For " << scopep->name() << " - " << varp->name() << " Scp "
|
||||
// << scpName << "Var " << varBase << endl);
|
||||
const string varBasePretty = AstNode::prettyName(VName::dehash(varBase));
|
||||
const string varBasePretty = AstNode::vpiName(VName::dehash(varBase));
|
||||
const string scpPretty = AstNode::prettyName(VName::dehash(scpName));
|
||||
const string scpSym = scopeSymString(VName::dehash(scpName));
|
||||
// UINFO(9, " scnameins sp " << scpName << " sp " << scpPretty << " ss "
|
||||
|
||||
Reference in New Issue
Block a user