Skip to content

Commit da37374

Browse files
committed
Apply review comments
Signed-off-by: Kamil Rakoczy <[email protected]>
1 parent 47d438a commit da37374

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

systemverilog-plugin/UhdmAst.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,11 +2488,11 @@ void UhdmAst::process_enum_typespec()
24882488

24892489
if (current_node->str.empty()) {
24902490
// anonymous typespec, check if not already created
2491-
if (shared.anonymous_enums.find(enum_object) != shared.anonymous_enums.end()) {
2491+
if (const auto enum_iter = shared.anonymous_enums.find(enum_object); enum_iter != shared.anonymous_enums.end()) {
24922492
// we already created typedef for this.
24932493
delete current_node;
2494-
current_node = new AST::AstNode(AST::AST_WIRETYPE);
2495-
current_node->str = shared.anonymous_enums[enum_object];
2494+
current_node = make_node(AST::AST_WIRETYPE);
2495+
current_node->str = enum_iter->second;
24962496
return;
24972497
}
24982498
}
@@ -2592,9 +2592,9 @@ void UhdmAst::process_enum_typespec()
25922592
auto current_scope = find_ancestor({AST::AST_PACKAGE, AST::AST_MODULE, AST::AST_BLOCK, AST::AST_GENBLOCK});
25932593
uhdmast_assert(current_scope != nullptr);
25942594
move_type_to_new_typedef(current_scope, current_node);
2595-
current_node = new AST::AstNode(AST::AST_WIRETYPE);
2595+
current_node = make_node(AST::AST_WIRETYPE);
25962596
current_node->str = typedef_name;
2597-
shared.anonymous_enums[enum_object] = typedef_name;
2597+
shared.anonymous_enums[enum_object] = std::move(typedef_name);
25982598
}
25992599
}
26002600

0 commit comments

Comments
 (0)