Skip to content

Commit

Permalink
repl: Adapt to newer tower API.
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorenc committed Jul 9, 2024
1 parent cd30707 commit 7be2edb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/vast/repl/state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace vast::repl {
//
// Tower related state
//
tw::location_info li;
tw::location_info_t location_info;
std::optional< tw::default_tower > tower;

std::unordered_map< std::string, tw::link_ptr > links;
Expand Down
19 changes: 14 additions & 5 deletions tools/vast-repl/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,21 @@ namespace cmd {

// TODO: Really naive way to visualize.
void render_link(const tw::link_ptr &ptr) {
auto flag = mlir::OpPrintingFlags().skipRegions();

auto render_op = [&](operation op) -> llvm::raw_fd_ostream & {
op->print(llvm::outs(), flag);
return llvm::outs();
};

auto render = [&](operation op) {
llvm::outs() << *op << "\n";
for (auto c : ptr->children(op))
llvm::outs() << "\t => " << *c << "\n";
render_op(op) << "\n";
for (auto c : ptr->children(op)) {
llvm::outs() << "\t => ";
render_op(c) << "\n";
}
};
ptr->from().mod->walk< mlir::WalkOrder::PreOrder >(render);
ptr->parent().mod->walk< mlir::WalkOrder::PreOrder >(render);
}

void check_source(const state_t &state) {
Expand Down Expand Up @@ -178,7 +187,7 @@ namespace cmd {
throw_error("failed to parse pass pipeline");
}
}
auto link = state.tower->apply(top, state.li, pm);
auto link = state.tower->apply(top, state.location_info, pm);
state.links.emplace(link_name, std::move(link));
}

Expand Down
17 changes: 17 additions & 0 deletions tools/vast-repl/state.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2024-present, Trail of Bits, Inc.

Check notice on line 1 in tools/vast-repl/state.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (18, 22.04)

Run clang-format on tools/vast-repl/state.cpp

File tools/vast-repl/state.cpp does not conform to Custom style guidelines. (lines 10, 11, 14, 15, 17)

#include "vast/repl/state.hpp"

VAST_RELAX_WARNINGS
VAST_UNRELAX_WARNINGS

namespace vast::repl {

void state_t::raise_tower(owning_module_ref mod) {
tower.emplace(ctx, li, std::move(mod));

Check failure on line 11 in tools/vast-repl/state.cpp

View workflow job for this annotation

GitHub Actions / cpp-linter (18, 22.04)

tools/vast-repl/state.cpp:11:28 [clang-diagnostic-error]

use of undeclared identifier 'li'
}

vast_module state_t::current_module() {
return tower->top().mod;
}
} // namespace vast::repl::codegen

0 comments on commit 7be2edb

Please sign in to comment.