retdec
const_null_pointer.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_IR_CONST_NULL_POINTER_H
8 #define RETDEC_LLVMIR2HLL_IR_CONST_NULL_POINTER_H
9 
12 
13 namespace retdec {
14 namespace llvmir2hll {
15 
16 class Expression;
17 class Visitor;
18 class PointerType;
19 
26 class ConstNullPointer final: public Constant {
27 public:
29 
30  virtual ShPtr<Value> clone() override;
31 
32  virtual bool isEqualTo(ShPtr<Value> otherValue) const override;
33  virtual ShPtr<Type> getType() const override;
34  virtual void replace(ShPtr<Expression> oldExpr,
35  ShPtr<Expression> newExpr) override;
36 
39  virtual void accept(Visitor *v) override;
41 
42 private:
45 
46 private:
47  // Since instances are created by calling the static function create(), the
48  // constructor can be private.
50 };
51 
52 } // namespace llvmir2hll
53 } // namespace retdec
54 
55 #endif
A null pointer constant.
Definition: const_null_pointer.h:26
ConstNullPointer(ShPtr< PointerType > type)
Constructs a null pointer constant of the given type.
Definition: const_null_pointer.cpp:20
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: const_null_pointer.cpp:56
virtual ShPtr< Value > clone() override
Returns a clone of the value.
Definition: const_null_pointer.cpp:23
virtual bool isEqualTo(ShPtr< Value > otherValue) const override
Returns true if this value is equal to otherValue, false otherwise.
Definition: const_null_pointer.cpp:29
virtual ShPtr< Type > getType() const override
Returns the type of the expression.
Definition: const_null_pointer.cpp:37
static ShPtr< ConstNullPointer > create(ShPtr< PointerType > type)
Creates a null pointer constant of the given type.
Definition: const_null_pointer.cpp:52
ShPtr< PointerType > type
Type of the constant.
Definition: const_null_pointer.h:44
virtual void replace(ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr) override
Replaces all occurrences of oldExpr with newExpr in the current expression.
Definition: const_null_pointer.cpp:41
A base class for all constants.
Definition: constant.h:20
A base class of all visitors.
Definition: visitor.h:95
A base class for all constants.
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.