Skip to content

Commit

Permalink
use get_if
Browse files Browse the repository at this point in the history
  • Loading branch information
esseivaju committed Sep 19, 2024
1 parent d1ffedb commit 8e23c9f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/orange/orangeinp/detail/DeMorganSimplifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,20 @@ void DeMorganSimplifier::find_join_negations()
},
[&](Joined const& joined) { handle_joined(node_id, joined); },
[&](Aliased const& aliased) {
auto const& alias_target = tree_[aliased.node];
auto const* target_node = &tree_[aliased.node];
CELER_EXPECT(
!std::holds_alternative<Aliased>(*target_node));
// treat the aliased node as its target
if (std::holds_alternative<Negated>(alias_target))
if (Negated const* negated
= std::get_if<Negated>(target_node))
{
handle_negated(node_id,
std::get<Negated>(alias_target));
handle_negated(node_id, *negated);
}
else if (std::holds_alternative<Joined>(alias_target))
else if (Joined const* joined
= std::get_if<Joined>(target_node))
{
handle_joined(node_id, std::get<Joined>(alias_target));
handle_joined(node_id, *joined);
}
CELER_EXPECT(
!std::holds_alternative<Aliased>(alias_target));
},
// Nothing to do for leaf node types
[](auto&&) {},
Expand Down

0 comments on commit 8e23c9f

Please sign in to comment.