retdec
array_type.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_IR_ARRAY_TYPE_H
8 #define RETDEC_LLVMIR2HLL_IR_ARRAY_TYPE_H
9 
10 #include <cstddef>
11 #include <vector>
12 
15 
16 namespace retdec {
17 namespace llvmir2hll {
18 
19 class Visitor;
20 
27 class ArrayType final: public Type {
28 public:
30  using Dimensions = std::vector<std::size_t>;
31 
32 public:
34 
35  virtual ShPtr<Value> clone() override;
36  virtual bool isEqualTo(ShPtr<Value> otherValue) const override;
37 
39  Dimensions getDimensions() const;
40  bool hasEmptyDimensions() const;
41 
44  virtual void accept(Visitor *v) override;
46 
47 private:
50 
53 
54 private:
55  // Since instances are created by calling the static function create(), the
56  // constructor can be private.
58 };
59 
60 } // namespace llvmir2hll
61 } // namespace retdec
62 
63 #endif
A representation of an array type.
Definition: array_type.h:27
std::vector< std::size_t > Dimensions
Array dimensions.
Definition: array_type.h:30
Dimensions getDimensions() const
Returns the dimensions of the array.
Definition: array_type.cpp:47
virtual bool isEqualTo(ShPtr< Value > otherValue) const override
Returns true if this value is equal to otherValue, false otherwise.
Definition: array_type.cpp:26
ArrayType(ShPtr< Type > elemType, const Dimensions &dims)
Constructs a new array type.
Definition: array_type.cpp:19
virtual ShPtr< Value > clone() override
Returns a clone of the value.
Definition: array_type.cpp:22
static ShPtr< ArrayType > create(ShPtr< Type > elemType, const Dimensions &dims)
Creates a new array type.
Definition: array_type.cpp:64
Dimensions dims
Array dimensions.
Definition: array_type.h:52
ShPtr< Type > elemType
Type of elements of the array.
Definition: array_type.h:49
bool hasEmptyDimensions() const
Are the dimensions empty?
Definition: array_type.cpp:54
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: array_type.cpp:69
ShPtr< Type > getContainedType() const
Returns the type of elements of the array.
Definition: array_type.cpp:40
A base class of all types.
Definition: type.h:20
A base class of all visitors.
Definition: visitor.h:95
A base class of all types.
A library providing API for working with back-end IR.
std::shared_ptr< T > ShPtr
An alias for a shared pointer.
Definition: smart_ptr.h:18
Definition: archive_wrapper.h:19
Declarations, aliases, macros, etc. for the use of smart pointers.