1*99558cc4SGreg Clayton //===-- CompilerDeclContext.cpp ---------------------------------*- C++ -*-===// 2*99558cc4SGreg Clayton // 3*99558cc4SGreg Clayton // The LLVM Compiler Infrastructure 4*99558cc4SGreg Clayton // 5*99558cc4SGreg Clayton // This file is distributed under the University of Illinois Open Source 6*99558cc4SGreg Clayton // License. See LICENSE.TXT for details. 7*99558cc4SGreg Clayton // 8*99558cc4SGreg Clayton //===----------------------------------------------------------------------===// 9*99558cc4SGreg Clayton 10*99558cc4SGreg Clayton #include "lldb/Symbol/CompilerDeclContext.h" 11*99558cc4SGreg Clayton #include "lldb/Symbol/TypeSystem.h" 12*99558cc4SGreg Clayton 13*99558cc4SGreg Clayton using namespace lldb_private; 14*99558cc4SGreg Clayton 15*99558cc4SGreg Clayton bool 16*99558cc4SGreg Clayton CompilerDeclContext::IsClang () const 17*99558cc4SGreg Clayton { 18*99558cc4SGreg Clayton return IsValid() && m_type_system->AsClangASTContext() != nullptr; 19*99558cc4SGreg Clayton } 20*99558cc4SGreg Clayton 21*99558cc4SGreg Clayton ConstString 22*99558cc4SGreg Clayton CompilerDeclContext::GetName () const 23*99558cc4SGreg Clayton { 24*99558cc4SGreg Clayton if (IsValid()) 25*99558cc4SGreg Clayton return m_type_system->DeclContextGetName(m_opaque_decl_ctx); 26*99558cc4SGreg Clayton else 27*99558cc4SGreg Clayton return ConstString(); 28*99558cc4SGreg Clayton } 29*99558cc4SGreg Clayton 30*99558cc4SGreg Clayton bool 31*99558cc4SGreg Clayton CompilerDeclContext::IsStructUnionOrClass () const 32*99558cc4SGreg Clayton { 33*99558cc4SGreg Clayton if (IsValid()) 34*99558cc4SGreg Clayton return m_type_system->DeclContextIsStructUnionOrClass(m_opaque_decl_ctx); 35*99558cc4SGreg Clayton else 36*99558cc4SGreg Clayton return false; 37*99558cc4SGreg Clayton } 38*99558cc4SGreg Clayton 39*99558cc4SGreg Clayton bool 40*99558cc4SGreg Clayton CompilerDeclContext::IsClassMethod (lldb::LanguageType *language_ptr, 41*99558cc4SGreg Clayton bool *is_instance_method_ptr, 42*99558cc4SGreg Clayton ConstString *language_object_name_ptr) 43*99558cc4SGreg Clayton { 44*99558cc4SGreg Clayton if (IsValid()) 45*99558cc4SGreg Clayton return m_type_system->DeclContextIsClassMethod (m_opaque_decl_ctx, 46*99558cc4SGreg Clayton language_ptr, 47*99558cc4SGreg Clayton is_instance_method_ptr, 48*99558cc4SGreg Clayton language_object_name_ptr); 49*99558cc4SGreg Clayton else 50*99558cc4SGreg Clayton return false; 51*99558cc4SGreg Clayton } 52*99558cc4SGreg Clayton 53*99558cc4SGreg Clayton bool 54*99558cc4SGreg Clayton lldb_private::operator == (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs) 55*99558cc4SGreg Clayton { 56*99558cc4SGreg Clayton return lhs.GetTypeSystem() == rhs.GetTypeSystem() && lhs.GetOpaqueDeclContext() == rhs.GetOpaqueDeclContext(); 57*99558cc4SGreg Clayton } 58*99558cc4SGreg Clayton 59*99558cc4SGreg Clayton 60*99558cc4SGreg Clayton bool 61*99558cc4SGreg Clayton lldb_private::operator != (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs) 62*99558cc4SGreg Clayton { 63*99558cc4SGreg Clayton return lhs.GetTypeSystem() != rhs.GetTypeSystem() || lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext(); 64*99558cc4SGreg Clayton } 65