From 7f85a1557c4d58f914a86c3054fd3ce78be3630a Mon Sep 17 00:00:00 2001 From: xlauko Date: Fri, 10 Jan 2025 14:35:11 +0100 Subject: [PATCH] query: Update symbol reference generation. --- tools/vast-query/vast-query.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/vast-query/vast-query.cpp b/tools/vast-query/vast-query.cpp index 63da6e30a2..2247a34c39 100644 --- a/tools/vast-query/vast-query.cpp +++ b/tools/vast-query/vast-query.cpp @@ -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(); }