blob: 2b632c5eb5d04b7f4beb8c9b1a6979c45f24955f [file] [log] [blame]
Paul Hermand628cbb2015-09-15 23:44:17 +00001//===-- CompilerDecl.cpp ----------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "lldb/Symbol/CompilerDecl.h"
11#include "lldb/Symbol/CompilerDeclContext.h"
12#include "lldb/Symbol/TypeSystem.h"
13
14using namespace lldb_private;
15
Kate Stoneb9c1b512016-09-06 20:57:50 +000016bool CompilerDecl::IsClang() const {
17 return IsValid() && m_type_system->getKind() == TypeSystem::eKindClang;
Paul Hermand628cbb2015-09-15 23:44:17 +000018}
19
Kate Stoneb9c1b512016-09-06 20:57:50 +000020ConstString CompilerDecl::GetName() const {
21 return m_type_system->DeclGetName(m_opaque_decl);
Paul Hermand628cbb2015-09-15 23:44:17 +000022}
23
Kate Stoneb9c1b512016-09-06 20:57:50 +000024ConstString CompilerDecl::GetMangledName() const {
25 return m_type_system->DeclGetMangledName(m_opaque_decl);
Greg Claytonfe689042015-11-10 17:47:04 +000026}
27
Kate Stoneb9c1b512016-09-06 20:57:50 +000028CompilerDeclContext CompilerDecl::GetDeclContext() const {
29 return m_type_system->DeclGetDeclContext(m_opaque_decl);
Greg Claytonfe689042015-11-10 17:47:04 +000030}
31
Kate Stoneb9c1b512016-09-06 20:57:50 +000032CompilerType CompilerDecl::GetFunctionReturnType() const {
33 return m_type_system->DeclGetFunctionReturnType(m_opaque_decl);
Greg Claytonfe689042015-11-10 17:47:04 +000034}
35
Kate Stoneb9c1b512016-09-06 20:57:50 +000036size_t CompilerDecl::GetNumFunctionArguments() const {
37 return m_type_system->DeclGetFunctionNumArguments(m_opaque_decl);
Greg Claytonfe689042015-11-10 17:47:04 +000038}
39
Kate Stoneb9c1b512016-09-06 20:57:50 +000040CompilerType CompilerDecl::GetFunctionArgumentType(size_t arg_idx) const {
41 return m_type_system->DeclGetFunctionArgumentType(m_opaque_decl, arg_idx);
Greg Claytonfe689042015-11-10 17:47:04 +000042}
43
Kate Stoneb9c1b512016-09-06 20:57:50 +000044bool 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();
Paul Hermand628cbb2015-09-15 23:44:17 +000048}
49
Kate Stoneb9c1b512016-09-06 20:57:50 +000050bool 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();
Paul Hermand628cbb2015-09-15 23:44:17 +000054}