File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed
Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -614,6 +614,7 @@ description_brace:
614614
615615description :
616616 module_declaration
617+ { PARSER.parse_tree.add_item(stack_expr($1 )); }
617618 | udp_declaration
618619 | interface_declaration
619620 | program_declaration
@@ -672,7 +673,8 @@ module_ansi_header:
672673module_declaration :
673674 module_nonansi_header module_item_brace TOK_ENDMODULE endmodule_identifier_opt
674675 {
675- PARSER.parse_tree.create_module(
676+ init ($$);
677+ stack_expr ($$) = PARSER.parse_tree.create_module(
676678 stack_expr ($1 ).operands()[0],
677679 stack_expr($1 ).operands()[1],
678680 stack_expr($1 ).operands()[2],
@@ -685,7 +687,8 @@ module_declaration:
685687 }
686688 | module_ansi_header module_item_brace TOK_ENDMODULE endmodule_identifier_opt
687689 {
688- PARSER.parse_tree.create_module(
690+ init ($$);
691+ stack_expr ($$) = PARSER.parse_tree .create_module (
689692 stack_expr ($1 ).operands ()[0 ],
690693 stack_expr ($1 ).operands ()[1 ],
691694 stack_expr ($1 ).operands ()[2 ],
@@ -697,9 +700,11 @@ module_declaration:
697700 pop_scope ();
698701 }
699702 | TOK_EXTERN module_nonansi_header
700- /* ignored for now */
703+ /* ignored for now */
704+ { init ($$); }
701705 | TOK_EXTERN module_ansi_header
702- /* ignored for now */
706+ /* ignored for now */
707+ { init ($$); }
703708 ;
704709
705710module_keyword:
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ bool verilog_languaget::parse(
8383
8484 parse_tree.swap (verilog_parser.parse_tree );
8585
86+ parse_tree.build_module_map ();
87+
8688 return result;
8789}
8890
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ Function: verilog_parse_treet::create_module
2121
2222\*******************************************************************/
2323
24- void verilog_parse_treet::create_module (
24+ exprt verilog_parse_treet::create_module (
2525 irept &attributes,
2626 irept &module_keyword,
2727 exprt &name,
@@ -41,10 +41,7 @@ void verilog_parse_treet::create_module(
4141 ((const exprt &)module_keyword).source_location ();
4242 new_module.add (ID_module_items) = std::move (module_items);
4343
44- auto &new_item = add_item (std::move (new_module));
45-
46- // add to module map
47- module_map[name.id ()] = &to_verilog_module_source (new_item);
44+ return static_cast <exprt &>(static_cast <irept &>(new_module));
4845}
4946
5047/* ******************************************************************\
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ class verilog_parse_treet
4848 return module_map.count (name)!=0 ;
4949 }
5050
51- void create_module (
51+ static exprt create_module (
5252 irept &attributes,
5353 irept &module_keyword,
5454 exprt &name,
You can’t perform that action at this time.
0 commit comments