blob: b749e79b459af7a61c92cddae49361c5eb6ef376 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
//===-- CompilerDecl.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_CompilerDecl_h_
#define liblldb_CompilerDecl_h_
#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Symbol/CompilerType.h"
namespace lldb_private {
class CompilerDecl
{
public:
//----------------------------------------------------------------------
// Constructors and Destructors
//----------------------------------------------------------------------
CompilerDecl () :
m_type_system (nullptr),
m_opaque_decl (nullptr)
{
}
CompilerDecl (TypeSystem *type_system, void *decl) :
m_type_system (type_system),
m_opaque_decl (decl)
{
}
~CompilerDecl ()
{
}
//----------------------------------------------------------------------
// Tests
//----------------------------------------------------------------------
explicit operator bool () const
{
return IsValid ();
}
bool
operator < (const CompilerDecl &rhs) const
{
if (m_type_system == rhs.m_type_system)
return m_opaque_decl < rhs.m_opaque_decl;
return m_type_system < rhs.m_type_system;
}
bool
IsValid () const
{
return m_type_system != nullptr && m_opaque_decl != nullptr;
}
bool
IsClang () const;
//----------------------------------------------------------------------
// Object linked to the decl
//----------------------------------------------------------------------
lldb::VariableSP
GetAsVariable ();
//----------------------------------------------------------------------
// Accessors
//----------------------------------------------------------------------
TypeSystem *
GetTypeSystem() const
{
return m_type_system;
}
void *
GetOpaqueDecl() const
{
return m_opaque_decl;
}
void
SetDecl (TypeSystem* type_system, void* decl)
{
m_type_system = type_system;
m_opaque_decl = decl;
}
void
Clear()
{
m_type_system = nullptr;
m_opaque_decl = nullptr;
}
ConstString
GetName () const;
ConstString
GetMangledName () const;
CompilerDeclContext
GetDeclContext() const;
// If this decl represents a function, return the return type
CompilerType
GetFunctionReturnType() const;
// If this decl represents a function, return the number of arguments for the function
size_t
GetNumFunctionArguments() const;
// If this decl represents a function, return the argument type given a zero based argument index
CompilerType
GetFunctionArgumentType (size_t arg_idx) const;
private:
TypeSystem *m_type_system;
void *m_opaque_decl;
};
bool operator == (const CompilerDecl &lhs, const CompilerDecl &rhs);
bool operator != (const CompilerDecl &lhs, const CompilerDecl &rhs);
} // namespace lldb_private
#endif // #ifndef liblldb_CompilerDecl_h_
|