@@ -402,55 +402,59 @@ inline verilog_set_genvarst &to_verilog_set_genvars(exprt &expr)
402
402
return static_cast <verilog_set_genvarst &>(expr);
403
403
}
404
404
405
- class verilog_parameter_declt : public verilog_module_itemt
405
+ // This class is used for all declarators in the parse tree
406
+ class verilog_declaratort : public exprt
406
407
{
407
408
public:
408
- inline verilog_parameter_declt () : verilog_module_itemt(ID_parameter_decl)
409
+ const irep_idt & identifier () const
409
410
{
411
+ return get (ID_identifier);
410
412
}
411
413
412
- class declaratort : public exprt
414
+ void identifier (irep_idt _identifier)
413
415
{
414
- public:
415
- const irep_idt &identifier () const
416
- {
417
- return get (ID_identifier);
418
- }
416
+ set (ID_identifier, _identifier);
417
+ }
419
418
420
- void identifier ( irep_idt _identifier)
421
- {
422
- set (ID_identifier, _identifier );
423
- }
419
+ const irep_idt & base_name () const
420
+ {
421
+ return get (ID_base_name );
422
+ }
424
423
425
- const irep_idt & base_name () const
426
- {
427
- return get (ID_base_name );
428
- }
424
+ const exprt & value () const
425
+ {
426
+ return static_cast < const exprt &>( find (ID_value) );
427
+ }
429
428
430
- const exprt &value () const
431
- {
432
- return static_cast <const exprt &>(find (ID_value));
433
- }
429
+ exprt &value ()
430
+ {
431
+ return static_cast <exprt &>(add (ID_value));
432
+ }
434
433
435
- exprt & value ()
436
- {
437
- return static_cast <exprt &>( add ( ID_value));
438
- }
434
+ bool has_value () const
435
+ {
436
+ return find ( ID_value). is_not_nil ( );
437
+ }
439
438
440
- bool has_value () const
441
- {
442
- return find (ID_value).is_not_nil ();
443
- }
439
+ // helper to generate a symbol expression
440
+ symbol_exprt symbol_expr () const
441
+ {
442
+ return symbol_exprt (identifier (), type ())
443
+ .with_source_location <symbol_exprt>(*this );
444
+ }
445
+ };
444
446
445
- // helper to generate a symbol expression
446
- symbol_exprt symbol_expr () const
447
- {
448
- return symbol_exprt (identifier (), type ())
449
- .with_source_location <symbol_exprt>(*this );
450
- }
451
- };
447
+ using verilog_declaratorst = std::vector<verilog_declaratort>;
448
+
449
+ class verilog_parameter_declt : public verilog_module_itemt
450
+ {
451
+ public:
452
+ inline verilog_parameter_declt () : verilog_module_itemt(ID_parameter_decl)
453
+ {
454
+ }
452
455
453
- using declaratorst = std::vector<declaratort>;
456
+ using declaratort = verilog_declaratort;
457
+ using declaratorst = verilog_declaratorst;
454
458
455
459
const declaratorst &declarations () const
456
460
{
@@ -484,8 +488,8 @@ class verilog_local_parameter_declt : public verilog_module_itemt
484
488
{
485
489
}
486
490
487
- using declaratort = verilog_parameter_declt::declaratort ;
488
- using declaratorst = std::vector<declaratort> ;
491
+ using declaratort = verilog_declaratort ;
492
+ using declaratorst = verilog_declaratorst ;
489
493
490
494
const declaratorst &declarations () const
491
495
{
@@ -516,7 +520,7 @@ class verilog_lett : public verilog_module_itemt
516
520
{
517
521
public:
518
522
// These have a single declarator.
519
- using declaratort = verilog_parameter_declt::declaratort ;
523
+ using declaratort = verilog_declaratort ;
520
524
521
525
const declaratort &declarator () const
522
526
{
@@ -700,8 +704,8 @@ class verilog_declt:public verilog_statementt
700
704
}
701
705
702
706
// When it's not a function or task, there are declarators.
703
- using declaratort = verilog_parameter_declt::declaratort ;
704
- using declaratorst = verilog_parameter_declt::declaratorst ;
707
+ using declaratort = verilog_declaratort ;
708
+ using declaratorst = verilog_declaratorst ;
705
709
706
710
declaratorst &declarators ()
707
711
{
0 commit comments