LIEF: Library to Instrument Executable Formats Version 0.17.0
Loading...
Searching...
No Matches
Parameter.hpp
Go to the documentation of this file.
1/* Copyright 2022 - 2025 R. Thomas
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15#ifndef LIEF_DWARF_PARAMETER_H
16#define LIEF_DWARF_PARAMETER_H
17
18#include "LIEF/visibility.h"
19
20#include <memory>
21#include <string>
22
23namespace LIEF {
24namespace dwarf {
25
26class Type;
27
28namespace details {
29class Parameter;
30}
31
37 public:
44 Parameter() = delete;
47 Parameter& operator=(const Parameter&) = delete;
48 Parameter(const Parameter&) = delete;
49
50 KIND kind() const;
51
53 std::string name() const;
54
56 std::unique_ptr<Type> type() const;
57
58 template<class T>
59 const T* as() const {
60 if (T::classof(this)) {
61 return static_cast<const T*>(this);
62 }
63 return nullptr;
64 }
65
66 virtual ~Parameter();
67
68 LIEF_LOCAL static
69 std::unique_ptr<Parameter> create(std::unique_ptr<details::Parameter> impl);
70
71 protected:
72 Parameter(std::unique_ptr<details::Parameter> impl);
73 std::unique_ptr<details::Parameter> impl_;
74};
75
76namespace parameters {
77
91class LIEF_API Formal : public Parameter {
92 public:
94 static bool classof(const Parameter* P) {
95 return P->kind() == Parameter::KIND::FORMAL;
96 }
97
98 ~Formal() override = default;
99};
100
101
113 public:
115 static bool classof(const Parameter* P) {
116 return P->kind() == Parameter::KIND::TEMPLATE_VALUE;
117 }
118
119 ~TemplateValue() override = default;
120};
121
133public:
135 static bool classof(const Parameter* P) {
136 return P->kind() == Parameter::KIND::TEMPLATE_TYPE;
137 }
138
139 ~TemplateType() override = default;
140};
141
142}
143
144}
145}
146#endif
std::string name() const
Name of the parameter.
Parameter(Parameter &&other)
Parameter & operator=(Parameter &&other)
KIND
Definition Parameter.hpp:38
@ TEMPLATE_VALUE
DW_TAG_template_value_parameter.
Definition Parameter.hpp:41
@ TEMPLATE_TYPE
DW_TAG_template_type_parameter.
Definition Parameter.hpp:40
@ UNKNOWN
Definition Parameter.hpp:39
@ FORMAL
DW_TAG_formal_parameter.
Definition Parameter.hpp:42
static std::unique_ptr< Parameter > create(std::unique_ptr< details::Parameter > impl)
std::unique_ptr< Type > type() const
Type of this parameter.
Parameter(const Parameter &)=delete
const T * as() const
Definition Parameter.hpp:59
Parameter & operator=(const Parameter &)=delete
This class represents a DWARF Type which includes:
Definition DWARF/Type.hpp:64
This class represents a regular function parameter.
Definition Parameter.hpp:91
static bool classof(const Parameter *P)
Definition Parameter.hpp:94
This class represents a template type parameter.
Definition Parameter.hpp:132
static bool classof(const Parameter *P)
Definition Parameter.hpp:135
This class represents a template value parameter.
Definition Parameter.hpp:112
static bool classof(const Parameter *P)
Definition Parameter.hpp:115
Definition DWARF/CompilationUnit.hpp:30
Definition Parameter.hpp:76
Namespace for the DWARF debug format.
Definition DWARF/CompilationUnit.hpp:28
LIEF namespace.
Definition Abstract/Binary.hpp:40
#define LIEF_API
Definition visibility.h:41
#define LIEF_LOCAL
Definition visibility.h:42