retdec
variable_replacer.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_SUPPORT_VARIABLE_REPLACER_H
8 #define RETDEC_LLVMIR2HLL_SUPPORT_VARIABLE_REPLACER_H
9 
13 
14 namespace retdec {
15 namespace llvmir2hll {
16 
17 class Function;
18 class Statement;
19 class Variable;
20 
29 public:
30  // It needs to be public so it can be called in ShPtr's destructor.
31  virtual ~VariableReplacer() override = default;
32 
34  ShPtr<Function> func);
35 
36 private:
38 
40 
44  virtual void visit(ShPtr<Variable> var) override;
46 
47 private:
50 
53 };
54 
55 } // namespace llvmir2hll
56 } // namespace retdec
57 
58 #endif
A visitor that visits everything in an ordered way.
Definition: ordered_all_visitor.h:44
virtual void visit(ShPtr< GlobalVarDef > varDef) override
Definition: ordered_all_visitor.cpp:95
A replacer of variables in functions.
Definition: variable_replacer.h:28
void performReplace(ShPtr< Function > func)
Performs the replace in func.
Definition: variable_replacer.cpp:37
ShPtr< Variable > oldVar
Old variable.
Definition: variable_replacer.h:49
virtual ~VariableReplacer() override=default
virtual void visit(ShPtr< GlobalVarDef > varDef) override
Definition: ordered_all_visitor.cpp:95
static void replaceVariable(ShPtr< Variable > oldVar, ShPtr< Variable > newVar, ShPtr< Function > func)
Replaces oldVar with newVar in func.
Definition: variable_replacer.cpp:28
ShPtr< Variable > newVar
New variable.
Definition: variable_replacer.h:52
VariableReplacer(ShPtr< Variable > oldVar, ShPtr< Variable > newVar)
Constructs a new replacer.
Definition: variable_replacer.cpp:22
A mixin to make classes non-copyable.
Definition: non_copyable.h:27
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
A mixin to make classes non-copyable.
A visitor that visits everything in an ordered way.
Declarations, aliases, macros, etc. for the use of smart pointers.