1 /* Copyright (c) 2007-2015. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #ifndef SIMGRID_MC_TYPE_HPP
8 #define SIMGRID_MC_TYPE_HPP
15 #include "src/mc/mc_forward.h"
16 #include "src/mc/LocationList.hpp"
21 /** A member of a structure, union
23 * Inheritance is seen as a special member as well.
29 bool inheritance = false;
31 simgrid::dwarf::DwarfExpression location_expression;
32 std::size_t byte_size = 0; // Do we really need this?
34 simgrid::mc::Type* type = nullptr;
36 bool has_offset_location() const
38 return location_expression.size() == 1 &&
39 location_expression[0].atom == DW_OP_plus_uconst;
42 // TODO, check if this shortcut is really necessary
45 xbt_assert(this->has_offset_location());
46 return this->location_expression[0].number;
49 void offset(int new_offset)
52 op.atom = DW_OP_plus_uconst;
53 op.number = new_offset;
54 this->location_expression = { op };
58 /** A type in the model-checked program */
62 Type(Type const& type) = default;
63 Type& operator=(Type const&) = default;
64 Type(Type&& type) = default;
65 Type& operator=(Type&&) = default;
67 /** The DWARF TAG of the type (e.g. DW_TAG_array_type) */
69 unsigned id = 0; /* Offset in the section (in hexadecimal form) */
70 std::string name; /* Name of the type */
71 int byte_size = 0; /* Size in bytes */
72 int element_count = 0; /* Number of elements for array type */
73 unsigned type_id = 0; /* DW_AT_type id */
74 std::vector<Member> members; /* if DW_TAG_structure_type, DW_TAG_class_type, DW_TAG_union_type*/
76 simgrid::mc::Type* subtype = nullptr; // DW_AT_type
77 simgrid::mc::Type* full_type = nullptr; // The same (but more complete) type