Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mc: move some files related to ELF, DWARF or unwind reading into their own directory
[simgrid.git] / src / mc / inspect / Type.hpp
similarity index 60%
rename from src/mc/Type.hpp
rename to src/mc/inspect/Type.hpp
index 7bc1464..4ae29aa 100644 (file)
@@ -8,14 +8,14 @@
 
 #include <cstddef>
 
 
 #include <cstddef>
 
-#include <vector>
 #include <string>
 #include <string>
+#include <vector>
 
 #include "xbt/asserts.h"
 #include "xbt/base.h"
 
 
 #include "xbt/asserts.h"
 #include "xbt/base.h"
 
+#include "src/mc/inspect/LocationList.hpp"
 #include "src/mc/mc_forward.hpp"
 #include "src/mc/mc_forward.hpp"
-#include "src/mc/LocationList.hpp"
 
 namespace simgrid {
 namespace mc {
 
 namespace simgrid {
 namespace mc {
@@ -27,7 +27,7 @@ namespace mc {
 class Member {
 public:
   typedef int flags_type;
 class Member {
 public:
   typedef int flags_type;
-  static constexpr flags_type INHERITANCE_FLAG = 1;
+  static constexpr flags_type INHERITANCE_FLAG     = 1;
   static constexpr flags_type VIRTUAL_POINTER_FLAG = 2;
 
   Member() = default;
   static constexpr flags_type VIRTUAL_POINTER_FLAG = 2;
 
   Member() = default;
@@ -43,35 +43,28 @@ public:
 
   std::size_t byte_size = 0; // Do we really need this?
 
 
   std::size_t byte_size = 0; // Do we really need this?
 
-  unsigned type_id = 0;
+  unsigned type_id        = 0;
   simgrid::mc::Type* type = nullptr;
 
   simgrid::mc::Type* type = nullptr;
 
-  bool isInheritance() const
-  {
-    return this->flags & INHERITANCE_FLAG;
-  }
-  bool isVirtualPointer() const
-  {
-    return this->flags & VIRTUAL_POINTER_FLAG;
-  }
+  bool isInheritance() const { return this->flags & INHERITANCE_FLAG; }
+  bool isVirtualPointer() const { return this->flags & VIRTUAL_POINTER_FLAG; }
 
   /** Whether the member is at a fixed offset from the base address */
   bool has_offset_location() const
   {
     // Recognize the expression `DW_OP_plus_uconst(offset)`:
 
   /** Whether the member is at a fixed offset from the base address */
   bool has_offset_location() const
   {
     // Recognize the expression `DW_OP_plus_uconst(offset)`:
-    return location_expression.size() == 1 &&
-      location_expression[0].atom == DW_OP_plus_uconst;
+    return location_expression.size() == 1 && location_expression[0].atom == DW_OP_plus_uconst;
   }
 
   /** Get the offset of the member
   }
 
   /** Get the offset of the member
-  *
-  *  This is only valid is the member is at a fixed offset from the base.
-  *  This is often the case (for C types, C++ type without virtual
-  *  inheritance).
-  *
-  *  If the location is more complex, the location expression has
-  *  to be evaluated (which might need accessing the memory).
-  */
+   *
+   *  This is only valid is the member is at a fixed offset from the base.
+   *  This is often the case (for C types, C++ type without virtual
+   *  inheritance).
+   *
+   *  If the location is more complex, the location expression has
+   *  to be evaluated (which might need accessing the memory).
+   */
   int offset() const
   {
     xbt_assert(this->has_offset_location());
   int offset() const
   {
     xbt_assert(this->has_offset_location());
@@ -83,11 +76,10 @@ public:
   {
     // Set the expression to be `DW_OP_plus_uconst(offset)`:
     Dwarf_Op op;
   {
     // Set the expression to be `DW_OP_plus_uconst(offset)`:
     Dwarf_Op op;
-    op.atom = DW_OP_plus_uconst;
-    op.number = new_offset;
-    this->location_expression = { op };
+    op.atom                   = DW_OP_plus_uconst;
+    op.number                 = new_offset;
+    this->location_expression = {op};
   }
   }
-
 };
 
 /** A type in the model-checked program */
 };
 
 /** A type in the model-checked program */
@@ -96,19 +88,19 @@ public:
   Type() = default;
 
   /** The DWARF TAG of the type (e.g. DW_TAG_array_type) */
   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 */
+  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*/
 
   std::vector<Member> members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/
 
-  simgrid::mc::Type* subtype = nullptr; // DW_AT_type
+  simgrid::mc::Type* subtype   = nullptr; // DW_AT_type
   simgrid::mc::Type* full_type = nullptr; // The same (but more complete) type
 };
 
   simgrid::mc::Type* full_type = nullptr; // The same (but more complete) type
 };
 
-}
-}
+} // namespace mc
+} // namespace simgrid
 
 #endif
 
 #endif