Skip to content

Commit

Permalink
query: Update symbol reference generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
xlauko committed Jan 10, 2025
1 parent 98cb898 commit 7f85a15
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions tools/vast-query/vast-query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,23 @@ namespace vast::query

logical_result do_show_users(auto scope) {
auto &name = cl::options->show_symbol_users;
auto name_attr = string_attr::get(scope->getContext(), name);

for (auto use : core::symbol_table::get_symbol_uses(name_attr, scope)) {
auto user = use.getUser();
user->print(llvm::outs());
llvm::outs() << show_location(*user) << "\n";
}
auto show_users = [scope] (operation decl) {
for (auto use : core::symbol_table::get_symbol_uses(decl, scope)) {
auto user = use.getUser();
user->print(llvm::outs());
llvm::outs() << show_location(*user) << "\n";
}
};

// TODO: walk decl above the scope
core::symbols< core::symbol >(scope, [&] (auto decl) {
if (decl.getSymbolName() == name) {
show_value(decl);
show_users(decl);
}
});


return mlir::success();
}
Expand Down

0 comments on commit 7f85a15

Please sign in to comment.