retdec
cfg_writer.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVMIR2HLL_GRAPHS_CFG_CFG_WRITER_H
8 #define RETDEC_LLVMIR2HLL_GRAPHS_CFG_CFG_WRITER_H
9 
10 #include <map>
11 #include <ostream>
12 #include <string>
13 
17 
18 namespace retdec {
19 namespace llvmir2hll {
20 
29 public:
30  virtual ~CFGWriter() = default;
31 
35  virtual std::string getId() const = 0;
36 
44  virtual bool emitCFG() = 0;
45 
46 protected:
48  using NodeLabelMapping = std::map<ShPtr<CFG::Node>, std::string>;
49 
50 protected:
51  CFGWriter(ShPtr<CFG> cfg, std::ostream &out);
52 
53 protected:
56 
58  std::ostream &out;
59 };
60 
61 } // namespace llvmir2hll
62 } // namespace retdec
63 
64 #endif
A representation of a control-flow graph (CFG).
A base class of all control-flow graph (CFG) writers.
Definition: cfg_writer.h:28
ShPtr< CFG > cfg
CFG to be emitted.
Definition: cfg_writer.h:55
virtual std::string getId() const =0
Returns the ID of the writer.
std::map< ShPtr< CFG::Node >, std::string > NodeLabelMapping
Mapping between a node and its label.
Definition: cfg_writer.h:48
virtual bool emitCFG()=0
Emits the given CFG into the given output stream.
std::ostream & out
Stream, where the resulting CFG will be emitted.
Definition: cfg_writer.h:58
CFGWriter(ShPtr< CFG > cfg, std::ostream &out)
Constructs a new writer.
Definition: cfg_writer.cpp:20
virtual ~CFGWriter()=default
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.
Declarations, aliases, macros, etc. for the use of smart pointers.