retdec
demangler_base.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_LLVM_DEMANGLE_RETDEC_H
8 #define RETDEC_LLVM_DEMANGLE_RETDEC_H
9 
10 #include <cstdint>
11 #include <string>
12 #include <memory>
13 #include <map>
14 
16 
17 namespace retdec {
18 
19 namespace ctypes {
20 class Module;
21 class Function;
22 class Type;
23 }
24 
25 namespace demangler {
26 
30 class Demangler
31 {
32 public:
33  enum Status : uint8_t
34  {
35  success = 0,
41  };
42 
43 public:
44  explicit Demangler(const std::string &compiler);
45 
46  virtual ~Demangler() = default;
47 
48  virtual std::string demangleToString(const std::string &mangled) = 0;
49 
50  virtual std::shared_ptr<ctypes::Function> demangleFunctionToCtypes(
51  const std::string &mangled,
52  std::unique_ptr<ctypes::Module> &module,
54  const ctypesparser::CTypesParser::TypeSignedness &typeSignedness,
55  unsigned defaultBitWidth) = 0;
56 
57  Status status();
58 
59 protected:
60  std::string _compiler;
62 };
63 
64 }
65 }
66 
67 #endif //RETDEC_LLVM_DEMANGLE_RETDEC_H
std::map< std::string, ctypes::IntegralType::Signess > TypeSignedness
Set container for C-types' signedness.
Definition: ctypes_parser.h:30
std::map< std::string, unsigned > TypeWidths
Set container for C-types' bit width.
Definition: ctypes_parser.h:28
Definition: demangler_base.h:31
Status status()
Definition: demangler_base.cpp:22
virtual std::shared_ptr< ctypes::Function > demangleFunctionToCtypes(const std::string &mangled, std::unique_ptr< ctypes::Module > &module, const ctypesparser::CTypesParser::TypeWidths &typeWidths, const ctypesparser::CTypesParser::TypeSignedness &typeSignedness, unsigned defaultBitWidth)=0
std::string _compiler
Definition: demangler_base.h:60
virtual std::string demangleToString(const std::string &mangled)=0
Demangler(const std::string &compiler)
Definition: demangler_base.cpp:16
virtual ~Demangler()=default
Status
Definition: demangler_base.h:34
@ invalid_mangled_name
Definition: demangler_base.h:39
@ init
Definition: demangler_base.h:36
@ unknown
Definition: demangler_base.h:40
@ memory_alloc_failure
Definition: demangler_base.h:38
@ init_fail
Definition: demangler_base.h:37
@ success
Definition: demangler_base.h:35
Status _status
Definition: demangler_base.h:61
Parser for C-types.
ShPtr< Module > module
The current module.
Definition: hll_writer.cpp:100
Definition: archive_wrapper.h:19