| Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 1 | //===-- CompilerDecl.cpp ----------------------------------------*- C++ -*-===// |
| 2 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 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 |
| Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "lldb/Symbol/CompilerDecl.h" |
| Raphael Isemann | 92d5ea5d | 2019-11-27 10:27:25 +0100 | [diff] [blame] | 10 | #include "lldb/Symbol/ClangASTContext.h" |
| Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 11 | #include "lldb/Symbol/CompilerDeclContext.h" |
| 12 | #include "lldb/Symbol/TypeSystem.h" |
| 13 | |
| 14 | using namespace lldb_private; |
| 15 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 16 | ConstString CompilerDecl::GetName() const { |
| 17 | return m_type_system->DeclGetName(m_opaque_decl); |
| Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 20 | ConstString CompilerDecl::GetMangledName() const { |
| 21 | return m_type_system->DeclGetMangledName(m_opaque_decl); |
| Greg Clayton | fe68904 | 2015-11-10 17:47:04 +0000 | [diff] [blame] | 22 | } |
| 23 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 24 | CompilerDeclContext CompilerDecl::GetDeclContext() const { |
| 25 | return m_type_system->DeclGetDeclContext(m_opaque_decl); |
| Greg Clayton | fe68904 | 2015-11-10 17:47:04 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 28 | CompilerType CompilerDecl::GetFunctionReturnType() const { |
| 29 | return m_type_system->DeclGetFunctionReturnType(m_opaque_decl); |
| Greg Clayton | fe68904 | 2015-11-10 17:47:04 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 32 | size_t CompilerDecl::GetNumFunctionArguments() const { |
| 33 | return m_type_system->DeclGetFunctionNumArguments(m_opaque_decl); |
| Greg Clayton | fe68904 | 2015-11-10 17:47:04 +0000 | [diff] [blame] | 34 | } |
| 35 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 36 | CompilerType CompilerDecl::GetFunctionArgumentType(size_t arg_idx) const { |
| 37 | return m_type_system->DeclGetFunctionArgumentType(m_opaque_decl, arg_idx); |
| Greg Clayton | fe68904 | 2015-11-10 17:47:04 +0000 | [diff] [blame] | 38 | } |
| 39 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 40 | bool lldb_private::operator==(const lldb_private::CompilerDecl &lhs, |
| 41 | const lldb_private::CompilerDecl &rhs) { |
| 42 | return lhs.GetTypeSystem() == rhs.GetTypeSystem() && |
| 43 | lhs.GetOpaqueDecl() == rhs.GetOpaqueDecl(); |
| Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 44 | } |
| 45 | |
| Kate Stone | b9c1b51 | 2016-09-06 20:57:50 +0000 | [diff] [blame] | 46 | bool lldb_private::operator!=(const lldb_private::CompilerDecl &lhs, |
| 47 | const lldb_private::CompilerDecl &rhs) { |
| 48 | return lhs.GetTypeSystem() != rhs.GetTypeSystem() || |
| 49 | lhs.GetOpaqueDecl() != rhs.GetOpaqueDecl(); |
| Paul Herman | d628cbb | 2015-09-15 23:44:17 +0000 | [diff] [blame] | 50 | } |