MCPcopy Create free account
hub / github.com/lief-project/LIEF / CompilationUnit>

Method CompilationUnit>

api/python/src/PDB/pyCompilationUnit.cpp:12–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10namespace LIEF::pdb::py {
11template<>
12void create<pdb::CompilationUnit>(nb::module_& m) {
13 nb::class_<pdb::CompilationUnit>(m, "CompilationUnit",
14 R"doc(
15 This class represents a Compilation Unit (or Module) in a PDB file
16 )doc"_doc
17 )
18 .def_prop_ro("module_name", &pdb::CompilationUnit::module_name,
19 R"doc(
20 Name (or path) to the COFF object (``.obj``) associated with this
21 compilation unit (e.g. ``e:\obj.amd64fre\minkernel\ntos\hvl\mp\objfre\amd64\hvlp.obj``)
22 )doc"_doc
23 )
24
25 .def_prop_ro("object_filename", &pdb::CompilationUnit::object_filename,
26 R"doc(
27 Name of path to the original binary object (COFF, Archive) in which
28 the compilation unit was located before being linked.
29 e.g. ``e:\obj.amd64fre\minkernel\ntos\hvl\mp\objfre\amd64\hvl.lib``
30 )doc"_doc
31 )
32
33 .def_prop_ro("sources",
34 [] (const pdb::CompilationUnit& self) {
35 auto sources = self.sources();
36 return nb::make_iterator<nb::rv_policy::reference_internal>(
37 nb::type<pdb::CompilationUnit>(), "sources_it", sources);
38 },
39 R"doc(
40 Iterator over the sources files that compose this compilation unit.
41 These files include **headers** (``.h, .hpp``, ...).
42 )doc"_doc, nb::keep_alive<0, 1>()
43 )
44 .def_prop_ro("functions",
45 [] (const pdb::CompilationUnit& self) {
46 auto functions = self.functions();
47 return nb::make_iterator<nb::rv_policy::reference_internal>(
48 nb::type<pdb::CompilationUnit>(), "functions_it", functions);
49 },
50 R"doc(
51 Return an iterator over the function defined in this compilation unit.
52 If the PDB does not contain or has an empty DBI stream, it returns
53 an empty iterator.
54 )doc"_doc, nb::keep_alive<0, 1>()
55 )
56 .def_prop_ro("build_metadata", &CompilationUnit::build_metadata,
57 nb::rv_policy::take_ownership, nb::keep_alive<0, 1>())
58 LIEF_DEFAULT_STR(CompilationUnit);
59}
60
61}

Callers

nothing calls this directly

Calls 2

sourcesMethod · 0.45
functionsMethod · 0.45

Tested by

no test coverage detected