Fix vpi_handle_by_name() handling of escaped identifiers when finding a toplevel module
find_scope() requires the hierarchical path to use escaped identifiers; without the leading '\' and trailing ' ', if there are any '.' characters, the path will be broken up at the wrong point(s).
This commit is contained in:
parent
22b68ad24d
commit
d4aef1e6d8
|
|
@ -1473,16 +1473,6 @@ vpiHandle vpi_handle_by_name(const char *name, vpiHandle scope)
|
||||||
*(nm_base-1) = 0;
|
*(nm_base-1) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*nm_base == '\\') {
|
|
||||||
// Skip the \ at the beginning
|
|
||||||
++nm_base;
|
|
||||||
|
|
||||||
// Drop the space at the end if it exists
|
|
||||||
if ((next = strchr(nm_base, ' '))) {
|
|
||||||
*next = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If there is no escaped identifier then just look for the last '.'
|
// If there is no escaped identifier then just look for the last '.'
|
||||||
} else {
|
} else {
|
||||||
nm_base = strrchr(nm_path, '.');
|
nm_base = strrchr(nm_path, '.');
|
||||||
|
|
@ -1554,6 +1544,18 @@ vpiHandle vpi_handle_by_name(const char *name, vpiHandle scope)
|
||||||
hand = tmp;
|
hand = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// find_name() expects escaped identifiers to be stripped
|
||||||
|
if (*nm_base == '\\') {
|
||||||
|
// Skip the \ at the beginning
|
||||||
|
++nm_base;
|
||||||
|
|
||||||
|
// Drop the space at the end if it exists
|
||||||
|
char *next;
|
||||||
|
if ((next = strchr(nm_base, ' '))) {
|
||||||
|
*next = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Now we have the correct scope, look for the item.
|
// Now we have the correct scope, look for the item.
|
||||||
vpiHandle out = find_name(nm_base, hand);
|
vpiHandle out = find_name(nm_base, hand);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue