| 1 | //===-- CompilerDecl.cpp --------------------------------------------------===// |
|---|---|
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "lldb/Symbol/CompilerDecl.h" |
| 10 | #include "lldb/Symbol/CompilerDeclContext.h" |
| 11 | #include "lldb/Symbol/TypeSystem.h" |
| 12 | #include "lldb/Utility/Scalar.h" |
| 13 | |
| 14 | using namespace lldb_private; |
| 15 | |
| 16 | ConstString CompilerDecl::GetName() const { |
| 17 | return m_type_system->DeclGetName(opaque_decl: m_opaque_decl); |
| 18 | } |
| 19 | |
| 20 | ConstString CompilerDecl::GetMangledName() const { |
| 21 | return m_type_system->DeclGetMangledName(opaque_decl: m_opaque_decl); |
| 22 | } |
| 23 | |
| 24 | CompilerDeclContext CompilerDecl::GetDeclContext() const { |
| 25 | return m_type_system->DeclGetDeclContext(opaque_decl: m_opaque_decl); |
| 26 | } |
| 27 | |
| 28 | CompilerType CompilerDecl::GetType() const { |
| 29 | return m_type_system->GetTypeForDecl(opaque_decl: m_opaque_decl); |
| 30 | } |
| 31 | |
| 32 | CompilerType CompilerDecl::GetFunctionReturnType() const { |
| 33 | return m_type_system->DeclGetFunctionReturnType(opaque_decl: m_opaque_decl); |
| 34 | } |
| 35 | |
| 36 | size_t CompilerDecl::GetNumFunctionArguments() const { |
| 37 | return m_type_system->DeclGetFunctionNumArguments(opaque_decl: m_opaque_decl); |
| 38 | } |
| 39 | |
| 40 | CompilerType CompilerDecl::GetFunctionArgumentType(size_t arg_idx) const { |
| 41 | return m_type_system->DeclGetFunctionArgumentType(opaque_decl: m_opaque_decl, arg_idx); |
| 42 | } |
| 43 | |
| 44 | bool lldb_private::operator==(const lldb_private::CompilerDecl &lhs, |
| 45 | const lldb_private::CompilerDecl &rhs) { |
| 46 | return lhs.GetTypeSystem() == rhs.GetTypeSystem() && |
| 47 | lhs.GetOpaqueDecl() == rhs.GetOpaqueDecl(); |
| 48 | } |
| 49 | |
| 50 | bool lldb_private::operator!=(const lldb_private::CompilerDecl &lhs, |
| 51 | const lldb_private::CompilerDecl &rhs) { |
| 52 | return lhs.GetTypeSystem() != rhs.GetTypeSystem() || |
| 53 | lhs.GetOpaqueDecl() != rhs.GetOpaqueDecl(); |
| 54 | } |
| 55 | |
| 56 | std::vector<lldb_private::CompilerContext> |
| 57 | CompilerDecl::GetCompilerContext() const { |
| 58 | return m_type_system->DeclGetCompilerContext(opaque_decl: m_opaque_decl); |
| 59 | } |
| 60 | |
| 61 | Scalar CompilerDecl::GetConstantValue() const { |
| 62 | return m_type_system->DeclGetConstantValue(opaque_decl: m_opaque_decl); |
| 63 | } |
| 64 |
