mirror of
https://github.com/verilator/verilator.git
synced 2026-10-07 10:33:13 +02:00
Fix --protect-ids when using SV classes (#2994)
A few names were incorrectly mangled, which made --protect-ids produce invalid output when certain SV class constructs were uses. Now fixed and added a few extra tests to catch this.
This commit is contained in:
+3
-1
@@ -1016,7 +1016,8 @@ public:
|
||||
}
|
||||
}
|
||||
string protectWordsIf(const string& old, bool doIt) {
|
||||
// Split at " " (for traces), "." (for scopes), or "->" (for scopes)
|
||||
// Split at " " (for traces), "." (for scopes), "->" (for scopes), "::" (for superclass
|
||||
// reference)
|
||||
if (!(doIt && v3Global.opt.protectIds())) return old;
|
||||
string out;
|
||||
string::size_type start = 0;
|
||||
@@ -1028,6 +1029,7 @@ public:
|
||||
trySep(old, start, " ", pos /*ref*/, separator /*ref*/);
|
||||
trySep(old, start, ".", pos /*ref*/, separator /*ref*/);
|
||||
trySep(old, start, "->", pos /*ref*/, separator /*ref*/);
|
||||
trySep(old, start, "::", pos /*ref*/, separator /*ref*/);
|
||||
if (pos == string::npos) break;
|
||||
out += protectIf(old.substr(start, pos - start), true) + separator;
|
||||
start = pos + separator.length();
|
||||
|
||||
Reference in New Issue
Block a user