@@ -4588,6 +4588,8 @@ inline array_comprehension_exprt &to_array_comprehension_expr(exprt &expr)
4588
4588
return ret;
4589
4589
}
4590
4590
4591
+ inline void validate_expr (const class class_method_descriptor_exprt &value);
4592
+
4591
4593
// / An expression describing a method on a class
4592
4594
class class_method_descriptor_exprt : public nullary_exprt
4593
4595
{
@@ -4617,6 +4619,7 @@ class class_method_descriptor_exprt : public nullary_exprt
4617
4619
set (ID_C_class, std::move (class_id));
4618
4620
set (ID_C_base_name, std::move (base_method_name));
4619
4621
set (ID_identifier, std::move (id));
4622
+ validate_expr (*this );
4620
4623
}
4621
4624
4622
4625
// / The method name after mangling it by combining it with the descriptor.
@@ -4654,6 +4657,23 @@ class class_method_descriptor_exprt : public nullary_exprt
4654
4657
}
4655
4658
};
4656
4659
4660
+ inline void validate_expr (const class class_method_descriptor_exprt &value)
4661
+ {
4662
+ validate_operands (value, 0 , " class method descriptor must not have operands" );
4663
+ DATA_INVARIANT (
4664
+ !value.mangled_method_name ().empty (),
4665
+ " class method descriptor must have a mangled method name." );
4666
+ DATA_INVARIANT (
4667
+ !value.class_id ().empty (), " class method descriptor must have a class id." );
4668
+ DATA_INVARIANT (
4669
+ !value.base_method_name ().empty (),
4670
+ " class method descriptor must have a base method name." );
4671
+ DATA_INVARIANT (
4672
+ value.get_identifier () == id2string (value.class_id ()) + " ." +
4673
+ id2string (value.mangled_method_name ()),
4674
+ " class method descriptor must have an identifier in the expected format." );
4675
+ }
4676
+
4657
4677
// / \brief Cast an exprt to a \ref class_method_descriptor_exprt
4658
4678
// /
4659
4679
// / \a expr must be known to be \ref class_method_descriptor_exprt.
0 commit comments