1 //===-- 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 
13 using namespace lldb_private;
14 
15 bool
16 CompilerDeclContext::IsClang () const
17 {
18     return IsValid() && m_type_system->AsClangASTContext() != nullptr;
19 }
20 
21 ConstString
22 CompilerDeclContext::GetName () const
23 {
24     if (IsValid())
25         return m_type_system->DeclContextGetName(m_opaque_decl_ctx);
26     else
27         return ConstString();
28 }
29 
30 bool
31 CompilerDeclContext::IsStructUnionOrClass () const
32 {
33     if (IsValid())
34         return m_type_system->DeclContextIsStructUnionOrClass(m_opaque_decl_ctx);
35     else
36         return false;
37 }
38 
39 bool
40 CompilerDeclContext::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 
53 bool
54 lldb_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 
60 bool
61 lldb_private::operator != (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs)
62 {
63     return lhs.GetTypeSystem() != rhs.GetTypeSystem() || lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext();
64 }
65