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

ebmc: add --show-module-hierarchy #178

Merged
merged 1 commit into from
Nov 30, 2023
Merged

ebmc: add --show-module-hierarchy #178

merged 1 commit into from
Nov 30, 2023

Conversation

kroening
Copy link
Member

This adds the command line option --show-module-hierarchy to ebmc, which outputs the hierarchy of modules, starting from the given top/main module.

@kroening kroening force-pushed the show-module-hierarchy branch from 112189b to 6ef62fd Compare November 22, 2023 18:19
@kroening kroening marked this pull request as ready for review November 22, 2023 18:23
Comment on lines 27 to 41
std::vector<irep_idt> instances;

for(auto &symbol : symbol_table.symbols)
if(
symbol.second.type.id() == ID_module_instance &&
symbol.second.module == main_symbol.name)
{
instances.push_back(symbol.first);
}

// sort the instances alphabetically
std::sort(
instances.begin(),
instances.end(),
[](irep_idt a, irep_idt b) { return a.compare(b) < 0; });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just ideas in case you want to pick it up one of them:

  1. Use a std::set<std::string> to represent instances (that's what we do in a bunch of places in CBMC)
  2. Use
auto comp = [](irep_idt a, irep_idt b) { return a.compare(b) < 0; };
std::set<irep_idt, decltype(comp)> instances(comp);

Copy link
Member Author

Choose a reason for hiding this comment

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

Now uses symbol_table.sorted_symbol_names()

This adds the command line option --show-module-hierarchy to ebmc, which
outputs the hierarchy of modules, starting from the given top/main module.
@kroening kroening force-pushed the show-module-hierarchy branch from 6ef62fd to 1b9546d Compare November 30, 2023 22:36
@kroening kroening merged commit 67e60bf into main Nov 30, 2023
3 of 4 checks passed
@kroening kroening deleted the show-module-hierarchy branch November 30, 2023 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants