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

Method CompilationUnit>

api/python/src/DWARF/pyCompilationUnit.cpp:17–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace LIEF::dwarf::py {
16template<>
17void create<dw::CompilationUnit>(nb::module_& m) {
18 nb::class_<dw::CompilationUnit> CU(m, "CompilationUnit",
19 R"doc(
20 This class represents a DWARF compilation unit
21 )doc"_doc
22 );
23
24 nb::class_<dw::CompilationUnit::Language> Lang(CU, "Language",
25 R"doc(
26 Languages supported by the DWARF (v5) format.
27 See: https://dwarfstd.org/languages.html
28
29 Some languages (like C++11, C++17, ..) have a version (11, 17, ...) which
30 is stored in a dedicated attribute: :attr:`~.version`
31 )doc"_doc
32 );
33
34 enum_<dw::CompilationUnit::Language::LANG>(Lang, "LANG")
35 .value("UNKNOWN", dw::CompilationUnit::Language::LANG::UNKNOWN)
36 .value("C", dw::CompilationUnit::Language::LANG::C)
37 .value("CPP", dw::CompilationUnit::Language::LANG::CPP)
38 .value("RUST", dw::CompilationUnit::Language::LANG::RUST)
39 .value("DART", dw::CompilationUnit::Language::LANG::DART)
40 .value("MODULA", dw::CompilationUnit::Language::LANG::MODULA)
41 .value("FORTRAN", dw::CompilationUnit::Language::LANG::FORTRAN)
42 .value("SWIFT", dw::CompilationUnit::Language::LANG::SWIFT)
43 .value("D", dw::CompilationUnit::Language::LANG::D)
44 .value("JAVA", dw::CompilationUnit::Language::LANG::JAVA)
45 .value("COBOL", dw::CompilationUnit::Language::LANG::COBOL)
46 ;
47
48 Lang
49 .def_rw("lang", &dw::CompilationUnit::Language::lang,
50 "The language itself")
51 .def_rw("version", &dw::CompilationUnit::Language::version,
52 "Version of the language (e.g. 17 for C++17)");
53
54 CU
55 .def_prop_ro("name", &dw::CompilationUnit::name,
56 R"doc(
57 Name of the file associated with this compilation unit (e.g. ``test.cpp``)
58 Return an **empty** string if the name is not found or can't be resolved
59
60 This value matches the ``DW_AT_name`` attribute.
61 )doc"_doc
62 )
63 .def_prop_ro("producer", &dw::CompilationUnit::producer,
64 R"doc(
65 Information about the program (or library) that generated this compilation
66 unit. For instance, it can output: ``Debian clang version 17.0.6``.
67
68 It returns an **empty** string if the producer is not present or can't be
69 resolved.
70
71 This value matches the ``DW_AT_producer`` attribute.
72 )doc"_doc
73
74 )

Callers

nothing calls this directly

Calls 5

valueMethod · 0.45
typesMethod · 0.45
functionsMethod · 0.45
imported_functionsMethod · 0.45
variablesMethod · 0.45

Tested by

no test coverage detected