@@ -412,55 +412,59 @@ inline verilog_set_genvarst &to_verilog_set_genvars(exprt &expr)
412
412
return static_cast <verilog_set_genvarst &>(expr);
413
413
}
414
414
415
- class verilog_parameter_declt : public verilog_module_itemt
415
+ // This class is used for all declarators in the parse tree
416
+ class verilog_declaratort : public exprt
416
417
{
417
418
public:
418
- inline verilog_parameter_declt () : verilog_module_itemt(ID_parameter_decl)
419
+ const irep_idt & identifier () const
419
420
{
421
+ return get (ID_identifier);
420
422
}
421
423
422
- class declaratort : public exprt
424
+ void identifier (irep_idt _identifier)
423
425
{
424
- public:
425
- const irep_idt &identifier () const
426
- {
427
- return get (ID_identifier);
428
- }
426
+ set (ID_identifier, _identifier);
427
+ }
429
428
430
- void identifier ( irep_idt _identifier)
431
- {
432
- set (ID_identifier, _identifier );
433
- }
429
+ const irep_idt & base_name () const
430
+ {
431
+ return get (ID_base_name );
432
+ }
434
433
435
- const irep_idt & base_name () const
436
- {
437
- return get (ID_base_name );
438
- }
434
+ const exprt & value () const
435
+ {
436
+ return static_cast < const exprt &>( find (ID_value) );
437
+ }
439
438
440
- const exprt &value () const
441
- {
442
- return static_cast <const exprt &>(find (ID_value));
443
- }
439
+ exprt &value ()
440
+ {
441
+ return static_cast <exprt &>(add (ID_value));
442
+ }
444
443
445
- exprt & value ()
446
- {
447
- return static_cast <exprt &>( add ( ID_value));
448
- }
444
+ bool has_value () const
445
+ {
446
+ return find ( ID_value). is_not_nil ( );
447
+ }
449
448
450
- bool has_value () const
451
- {
452
- return find (ID_value).is_not_nil ();
453
- }
449
+ // helper to generate a symbol expression
450
+ symbol_exprt symbol_expr () const
451
+ {
452
+ return symbol_exprt (identifier (), type ())
453
+ .with_source_location <symbol_exprt>(*this );
454
+ }
455
+ };
454
456
455
- // helper to generate a symbol expression
456
- symbol_exprt symbol_expr () const
457
- {
458
- return symbol_exprt (identifier (), type ())
459
- .with_source_location <symbol_exprt>(*this );
460
- }
461
- };
457
+ using verilog_declaratorst = std::vector<verilog_declaratort>;
458
+
459
+ class verilog_parameter_declt : public verilog_module_itemt
460
+ {
461
+ public:
462
+ inline verilog_parameter_declt () : verilog_module_itemt(ID_parameter_decl)
463
+ {
464
+ }
462
465
463
- using declaratorst = std::vector<declaratort>;
466
+ using declaratort = verilog_declaratort;
467
+ using declaratorst = verilog_declaratorst;
464
468
465
469
const declaratorst &declarations () const
466
470
{
@@ -494,8 +498,8 @@ class verilog_local_parameter_declt : public verilog_module_itemt
494
498
{
495
499
}
496
500
497
- using declaratort = verilog_parameter_declt::declaratort ;
498
- using declaratorst = std::vector<declaratort> ;
501
+ using declaratort = verilog_declaratort ;
502
+ using declaratorst = verilog_declaratorst ;
499
503
500
504
const declaratorst &declarations () const
501
505
{
@@ -526,7 +530,7 @@ class verilog_lett : public verilog_module_itemt
526
530
{
527
531
public:
528
532
// These have a single declarator.
529
- using declaratort = verilog_parameter_declt::declaratort ;
533
+ using declaratort = verilog_declaratort ;
530
534
531
535
const declaratort &declarator () const
532
536
{
@@ -715,8 +719,8 @@ class verilog_declt:public verilog_statementt
715
719
}
716
720
717
721
// When it's not a function or task, there are declarators.
718
- using declaratort = verilog_parameter_declt::declaratort ;
719
- using declaratorst = verilog_parameter_declt::declaratorst ;
722
+ using declaratort = verilog_declaratort ;
723
+ using declaratorst = verilog_declaratorst ;
720
724
721
725
declaratorst &declarators ()
722
726
{
0 commit comments