Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SystemVerilog: discover package dependencies in expressions and types #968

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

kroening
Copy link
Member

@kroening kroening commented Feb 5, 2025

Dependencies on a package via the package scope operator :: are now discovered when used in types or expressions.

@kroening kroening marked this pull request as ready for review February 5, 2025 16:04
@tautschnig
Copy link
Collaborator

Is the change to the cbmc submodule intentional?

@kroening kroening force-pushed the verilog-package-dep branch from 5d925d2 to 35cb0c3 Compare February 6, 2025 16:33
@kroening
Copy link
Member Author

kroening commented Feb 6, 2025

Fixed

Comment on lines 89 to 99
if(expr.id() == ID_verilog_package_scope)
{
auto &package_scope_expr = to_verilog_package_scope_expr(expr);
dest.push_back(
verilog_package_identifier(package_scope_expr.package_base_name()));
}
else
{
for(auto &op : expr.operands())
dependencies_rec(op, dest);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of reducing (or: not further increasing) the use of recursion when traversing expressions (which at times is causing stack overflows for us): can we please use an expr iterator here:

for(const_depth_iteratort it = expr.depth_cbegin(); it != expr.depth_cend(); ++it)
{
  if(it->id() == ID_verilog_package_scope)
  {
    auto &package_scope_expr = to_verilog_package_scope_expr(*it);
    dest.push_back(
      verilog_package_identifier(package_scope_expr.package_base_name()));
  }
}

Dependencies on a package via the package scope operator :: are now
discovered when used in types or expressions.
@kroening kroening force-pushed the verilog-package-dep branch from 35cb0c3 to 6e562d3 Compare February 8, 2025 12:38
@kroening kroening merged commit 578d1af into main Feb 8, 2025
9 checks passed
@kroening kroening deleted the verilog-package-dep branch February 8, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants