blob: 948ee74c65307a224a5556d480164129652f5258 [file] [log] [blame]
Greg Clayton99558cc42015-08-24 23:46:31 +00001//===-- CompilerDeclContext.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/CompilerDeclContext.h"
11#include "lldb/Symbol/TypeSystem.h"
12
13using namespace lldb_private;
14
15bool
16CompilerDeclContext::IsClang () const
17{
18 return IsValid() && m_type_system->AsClangASTContext() != nullptr;
19}
20
21ConstString
22CompilerDeclContext::GetName () const
23{
24 if (IsValid())
25 return m_type_system->DeclContextGetName(m_opaque_decl_ctx);
26 else
27 return ConstString();
28}
29
30bool
31CompilerDeclContext::IsStructUnionOrClass () const
32{
33 if (IsValid())
34 return m_type_system->DeclContextIsStructUnionOrClass(m_opaque_decl_ctx);
35 else
36 return false;
37}
38
39bool
40CompilerDeclContext::IsClassMethod (lldb::LanguageType *language_ptr,
41 bool *is_instance_method_ptr,
42 ConstString *language_object_name_ptr)
43{
44 if (IsValid())
45 return m_type_system->DeclContextIsClassMethod (m_opaque_decl_ctx,
46 language_ptr,
47 is_instance_method_ptr,
48 language_object_name_ptr);
49 else
50 return false;
51}
52
53bool
54lldb_private::operator == (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs)
55{
56 return lhs.GetTypeSystem() == rhs.GetTypeSystem() && lhs.GetOpaqueDeclContext() == rhs.GetOpaqueDeclContext();
57}
58
59
60bool
61lldb_private::operator != (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs)
62{
63 return lhs.GetTypeSystem() != rhs.GetTypeSystem() || lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext();
64}