Go to the documentation of this file.
15#ifndef LIEF_DWARF_FUNCTION_H
16#define LIEF_DWARF_FUNCTION_H
45 using iterator_category = std::bidirectional_iterator_tag;
46 using value_type = std::unique_ptr<Function>;
47 using difference_type = std::ptrdiff_t;
48 using pointer = Function*;
49 using reference = std::unique_ptr<Function>&;
50 using implementation = details::FunctionIt;
54 friend class Iterator;
61 template <
typename RefT>
62 PointerProxy(RefT &&R) : R(std::forward<RefT>(R)) {}
67 Iterator(std::unique_ptr<details::FunctionIt> impl);
70 friend
LIEF_API bool operator==(const Iterator& LHS, const Iterator& RHS);
72 friend
LIEF_API bool operator!=(const Iterator& LHS, const Iterator& RHS) {
80 Iterator tmp = *
static_cast<Iterator*
>(
this);
81 --*
static_cast<Iterator *
>(
this);
86 Iterator tmp = *
static_cast<Iterator*
>(
this);
87 ++*
static_cast<Iterator *
>(
this);
94 return static_cast<const Iterator*
>(
this)->
operator*();
98 std::unique_ptr<details::FunctionIt> impl_;
100 using vars_it = iterator_range<Variable::Iterator>;
103 using parameters_t = std::vector<std::unique_ptr<Parameter>>;
104 using thrown_types_t = std::vector<std::unique_ptr<Type>>;
107 std::string
name()
const;
116 result<uint64_t>
address()
const;
132 uint64_t
size()
const;
135 std::vector<range_t>
ranges()
const;
141 std::unique_ptr<Type>
type()
const;
162 std::unique_ptr<Scope>
scope()
const;
168 std::unique_ptr<details::Function> impl_;
pointer operator->() const
Definition DWARF/Function.hpp:56
Iterator operator++(int)
Definition DWARF/Function.hpp:85
std::unique_ptr< Function > operator*() const
Iterator(Iterator &&) noexcept
Iterator operator--(int)
Definition DWARF/Function.hpp:79
PointerProxy operator->() const
Definition DWARF/Function.hpp:93
Iterator(const Iterator &)
This class represents a DWARF function which can be associated with either: DW_TAG_subprogram or DW_T...
Definition DWARF/Function.hpp:41
vars_it variables() const
Return an iterator of variables (DW_TAG_variable) defined within the scope of this function....
thrown_types_t thrown_types() const
List of exceptions (types) that can be thrown by the function.
std::unique_ptr< Type > type() const
Return the dwarf::Type associated with the return type of this function.
std::unique_ptr< Scope > scope() const
Return the scope in which this function is defined.
Function(std::unique_ptr< details::Function > impl)
std::string name() const
The name of the function (DW_AT_name)
bool is_external() const
Whether the function is defined outside the current compilation unit (DW_AT_external).
result< uint64_t > address() const
Return the address of the function (DW_AT_entry_pc or DW_AT_low_pc).
debug_location_t debug_location() const
Original source code location.
std::vector< range_t > ranges() const
Ranges of virtual addresses owned by this function.
parameters_t parameters() const
Return the function's parameters (including any template parameter)
uint64_t size() const
Return the size taken by this function in the binary.
std::string linkage_name() const
The name of the function which is used for linking (DW_AT_linkage_name).
bool is_artificial() const
Whether this function is created by the compiler and not present in the original source code.
This class represents a DWARF parameter which can be either:
Definition Parameter.hpp:36
This class materializes a scope in which Function, Variable, Type, ... can be defined.
Definition Scope.hpp:32
Definition DWARF/CompilationUnit.hpp:30
Namespace for the DWARF debug format.
Definition DWARF/CompilationUnit.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41