Skip to content

Commit

Permalink
Yul SSACFG JSON export fix: Function arguments are referenced by thei…
Browse files Browse the repository at this point in the history
…r value ids
  • Loading branch information
clonker committed Oct 31, 2024
1 parent 654ce6b commit 24a9e7d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libyul/YulControlFlowGraphExporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ Json YulControlFlowGraphExporter::exportFunction(SSACFG const& _cfg)
Json functionJson = Json::object();
functionJson["type"] = "Function";
functionJson["entry"] = "Block" + std::to_string(_cfg.entry.value);
functionJson["arguments"] = Json::array();
for (auto const& [arg, valueId]: _cfg.arguments)
functionJson["arguments"].emplace_back(arg.get().name.str());
static auto constexpr argsTransform = [](auto const& arg) { return fmt::format("v{}", std::get<1>(arg).value); };
functionJson["arguments"] = _cfg.arguments | ranges::views::transform(argsTransform) | ranges::to<std::vector>;
functionJson["returns"] = Json::array();
for (auto const& ret: _cfg.returns)
functionJson["returns"].emplace_back(ret.get().name.str());
Expand Down

0 comments on commit 24a9e7d

Please sign in to comment.