File indexing completed on 2026-05-10 08:42:51
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_SYMBOL_COMPILERDECL_H
0010 #define LLDB_SYMBOL_COMPILERDECL_H
0011
0012 #include "lldb/Symbol/CompilerType.h"
0013 #include "lldb/Utility/ConstString.h"
0014 #include "lldb/lldb-private.h"
0015
0016 namespace lldb_private {
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 class CompilerDecl {
0029 public:
0030
0031 CompilerDecl() = default;
0032
0033
0034
0035
0036
0037 CompilerDecl(TypeSystem *type_system, void *decl)
0038 : m_type_system(type_system), m_opaque_decl(decl) {}
0039
0040
0041
0042 explicit operator bool() const { return IsValid(); }
0043
0044 bool operator<(const CompilerDecl &rhs) const {
0045 if (m_type_system == rhs.m_type_system)
0046 return m_opaque_decl < rhs.m_opaque_decl;
0047 return m_type_system < rhs.m_type_system;
0048 }
0049
0050 bool IsValid() const {
0051 return m_type_system != nullptr && m_opaque_decl != nullptr;
0052 }
0053
0054
0055
0056 TypeSystem *GetTypeSystem() const { return m_type_system; }
0057
0058 void *GetOpaqueDecl() const { return m_opaque_decl; }
0059
0060 void SetDecl(TypeSystem *type_system, void *decl) {
0061 m_type_system = type_system;
0062 m_opaque_decl = decl;
0063 }
0064
0065 void Clear() {
0066 m_type_system = nullptr;
0067 m_opaque_decl = nullptr;
0068 }
0069
0070 ConstString GetName() const;
0071
0072 ConstString GetMangledName() const;
0073
0074 CompilerDeclContext GetDeclContext() const;
0075
0076
0077 CompilerType GetType() const;
0078
0079
0080 CompilerType GetFunctionReturnType() const;
0081
0082
0083
0084 size_t GetNumFunctionArguments() const;
0085
0086
0087
0088 CompilerType GetFunctionArgumentType(size_t arg_idx) const;
0089
0090
0091
0092
0093
0094
0095 std::vector<lldb_private::CompilerContext> GetCompilerContext() const;
0096
0097
0098
0099 Scalar GetConstantValue() const;
0100
0101 private:
0102 TypeSystem *m_type_system = nullptr;
0103 void *m_opaque_decl = nullptr;
0104 };
0105
0106 bool operator==(const CompilerDecl &lhs, const CompilerDecl &rhs);
0107 bool operator!=(const CompilerDecl &lhs, const CompilerDecl &rhs);
0108
0109 }
0110
0111 #endif