| 16 | namespace LIEF::dwarf::py { |
| 17 | template<> |
| 18 | void create<dw::editor::CompilationUnit>(nb::module_& m) { |
| 19 | nb::class_<dw::editor::CompilationUnit> CU(m, "CompilationUnit", |
| 20 | R"doc( |
| 21 | This class represents an **editable** DWARF compilation unit |
| 22 | )doc"_doc |
| 23 | ); |
| 24 | |
| 25 | CU |
| 26 | .def("set_producer", &dw::editor::CompilationUnit::set_producer, |
| 27 | R"doc( |
| 28 | Set the ``DW_AT_producer`` producer attribute. |
| 29 | |
| 30 | This attribute aims to inform about the program that generated this |
| 31 | compilation unit (e.g. ``LIEF Extended``) |
| 32 | )doc"_doc, nb::rv_policy::reference_internal) |
| 33 | |
| 34 | .def("create_function", &dw::editor::CompilationUnit::create_function, |
| 35 | "Create a new function owned by this compilation unit"_doc, |
| 36 | "name"_a) |
| 37 | |
| 38 | .def("create_variable", &dw::editor::CompilationUnit::create_variable, |
| 39 | "Create a new **global** variable owned by this compilation unit"_doc, |
| 40 | "name"_a) |
| 41 | |
| 42 | .def("create_generic_type", &dw::editor::CompilationUnit::create_generic_type, |
| 43 | "Create a ``DW_TAG_unspecified_type`` type with the given name"_doc, |
| 44 | "name"_a) |
| 45 | |
| 46 | .def("create_enum", &dw::editor::CompilationUnit::create_enum, |
| 47 | "Create an enum type (``DW_TAG_enumeration_type``)"_doc, |
| 48 | "name"_a) |
| 49 | |
| 50 | .def("create_typedef", &dw::editor::CompilationUnit::create_typedef, |
| 51 | R"doc( |
| 52 | Create a typdef with the name provided in the first parameter which aliases |
| 53 | the type provided in the second parameter |
| 54 | )doc"_doc, "name"_a, "ty"_a) |
| 55 | |
| 56 | .def("create_structure", &dw::editor::CompilationUnit::create_structure, |
| 57 | "Create a struct-like type (struct, class, union) with the given name"_doc, |
| 58 | "name"_a, "kind"_a = dw::editor::StructType::TYPE::STRUCT) |
| 59 | |
| 60 | .def("create_base_type", &dw::editor::CompilationUnit::create_base_type, |
| 61 | "Create a primitive type with the given name and size."_doc, |
| 62 | "name"_a, "size"_a, "encoding"_a = dw::editor::BaseType::ENCODING::NONE) |
| 63 | |
| 64 | .def("create_function_type", &dw::editor::CompilationUnit::create_function_type, |
| 65 | "Create a function type with the given name."_doc, "name"_a) |
| 66 | |
| 67 | .def("create_pointer_type", &dw::editor::CompilationUnit::create_pointer_type, |
| 68 | "Create a pointer on the provided type."_doc, "ty"_a) |
| 69 | |
| 70 | .def("create_void_type", &dw::editor::CompilationUnit::create_void_type, |
| 71 | "Create a ``void`` type"_doc) |
| 72 | |
| 73 | .def("create_array", &dw::editor::CompilationUnit::create_array, |
| 74 | "Create an array type with the given name, type and size."_doc, |
| 75 | "name"_a, "ty"_a, "count"_a) |
nothing calls this directly
no outgoing calls
no test coverage detected