retdec
call_stmt.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_IR_CALL_STMT_H
8 #define RETDEC_LLVMIR2HLL_IR_CALL_STMT_H
9 
12 
13 namespace retdec {
14 namespace llvmir2hll {
15 
16 class CallExpr;
17 class Expression;
18 class Visitor;
19 
26 class CallStmt final: public Statement {
27 public:
30 
31  virtual bool isEqualTo(ShPtr<Value> otherValue) const override;
32  virtual bool isCompound() override { return false; }
33  virtual ShPtr<Value> clone() override;
34  virtual void replace(ShPtr<Expression> oldExpr, ShPtr<Expression> newExpr) override;
35  virtual ShPtr<Expression> asExpression() const override;
36 
37  ShPtr<CallExpr> getCall() const;
38  void setCall(ShPtr<CallExpr> newCall);
39 
42  virtual void update(ShPtr<Value> subject, ShPtr<Value> arg = nullptr) override;
44 
47  virtual void accept(Visitor *v) override;
49 
50 private:
51  // Since instances are created by calling the static function create(), the
52  // constructor can be private.
54 
55 private:
58 };
59 
60 } // namespace llvmir2hll
61 } // namespace retdec
62 
63 #endif
Definition: address.h:21
static const uint64_t Undefined
Definition: address.h:47
A statement wrapping a call expression.
Definition: call_stmt.h:26
virtual ShPtr< Value > clone() override
Returns a clone of the value.
Definition: call_stmt.cpp:31
virtual bool isEqualTo(ShPtr< Value > otherValue) const override
Returns true if this value is equal to otherValue, false otherwise.
Definition: call_stmt.cpp:23
virtual ShPtr< Expression > asExpression() const override
Returns the statement as an expression.
Definition: call_stmt.cpp:46
CallStmt(ShPtr< CallExpr > call, Address a=Address::Undefined)
Constructs a new call statement.
Definition: call_stmt.cpp:20
static ShPtr< CallStmt > create(ShPtr< CallExpr > call, ShPtr< Statement > succ=nullptr, Address a=Address::Undefined)
Constructs a new call statement.
Definition: call_stmt.cpp:81
ShPtr< CallExpr > call
Wrapped call expression.
Definition: call_stmt.h:57
virtual void update(ShPtr< Value > subject, ShPtr< Value > arg=nullptr) override
Updates the statement according to the changes of subject.
Definition: call_stmt.cpp:112
virtual bool isCompound() override
Returns true if the statement is a compound statement, false otherwise.
Definition: call_stmt.h:32
ShPtr< CallExpr > getCall() const
Returns the contained call.
Definition: call_stmt.cpp:53
void setCall(ShPtr< CallExpr > newCall)
Sets a new contained call.
Definition: call_stmt.cpp:63
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: call_stmt.cpp:122
virtual void replace(ShPtr< Expression > oldExpr, ShPtr< Expression > newExpr) override
Replaces all occurrences of oldExpr with newExpr in the current statement.
Definition: call_stmt.cpp:38
A representation of a program statement.
Definition: statement.h:39
ShPtr< Statement > succ
Successor statement.
Definition: statement.h:141
A base class of all visitors.
Definition: visitor.h:95
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.
A representation of a program statement.