Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Member initialization in Variable, Member, Type
[simgrid.git] / src / mc / Type.hpp
index 032ad2c..5a6a2ad 100644 (file)
 
 #include <xbt/base.h>
 
-#include "mc_forward.h"
-#include "mc_location.h"
+#include "src/mc/mc_forward.h"
+#include "src/mc/LocationList.hpp"
 
 namespace simgrid {
 namespace mc {
 
-/** Represents a type in the program
+/** A member of a structure, union
  *
- *  It is currently used to represent members of structs and unions as well.
+ *  Inheritance is seen as a special member as well.
  */
-class Type {
+class Member {
 public:
-  Type();
-  Type(Type const& type) = default;
-  Type& operator=(Type const&) = default;
-  Type(Type&& type) = default;
-  Type& operator=(Type&&) = default;
+  Member() {}
 
-  /** The DWARF TAG of the type (e.g. DW_TAG_array_type) */
-  int type;
-  unsigned id; /* Offset in the section (in hexadecimal form) */
-  std::string name; /* Name of the type */
-  int byte_size; /* Size in bytes */
-  int element_count; /* Number of elements for array type */
-  unsigned type_id; /* DW_AT_type id */
-  std::vector<Type> members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/
-  int is_pointer_type;
-
-  // Location (for members) is either of:
-  simgrid::mc::DwarfExpression location_expression;
-
-  simgrid::mc::Type* subtype; // DW_AT_type
-  simgrid::mc::Type* full_type; // The same (but more complete) type
+  bool inheritance = false;
+  std::string name;
+  simgrid::dwarf::DwarfExpression location_expression;
+  std::size_t byte_size = 0; // Do we really need this?
+  unsigned type_id = 0;
+  simgrid::mc::Type* type = nullptr;
 
   bool has_offset_location() const
   {
@@ -61,25 +48,35 @@ public:
 
   void offset(int new_offset)
   {
-    DwarfInstruction op;
+    Dwarf_Op op;
     op.atom = DW_OP_plus_uconst;
     op.number = new_offset;
     this->location_expression = { op };
   }
 };
 
-inline
-Type::Type()
-{
-  this->type = 0;
-  this->id = 0;
-  this->byte_size = 0;
-  this->element_count = 0;
-  this->is_pointer_type = 0;
-  this->type_id = 0;
-  this->subtype = nullptr;
-  this->full_type = nullptr;
-}
+/** A type in the model-checked program */
+class Type {
+public:
+  Type() {}
+  Type(Type const& type) = default;
+  Type& operator=(Type const&) = default;
+  Type(Type&& type) = default;
+  Type& operator=(Type&&) = default;
+
+  /** The DWARF TAG of the type (e.g. DW_TAG_array_type) */
+  int type = 0;
+  unsigned id = 0; /* Offset in the section (in hexadecimal form) */
+  std::string name; /* Name of the type */
+  int byte_size = 0; /* Size in bytes */
+  int element_count = 0; /* Number of elements for array type */
+  unsigned type_id = 0; /* DW_AT_type id */
+  std::vector<Member> members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/
+  int is_pointer_type = 0;
+
+  simgrid::mc::Type* subtype = nullptr; // DW_AT_type
+  simgrid::mc::Type* full_type = nullptr; // The same (but more complete) type
+};
 
 }
 }