199558cc4SGreg Clayton //===-- CompilerDeclContext.cpp ---------------------------------*- C++ -*-===// 299558cc4SGreg Clayton // 399558cc4SGreg Clayton // The LLVM Compiler Infrastructure 499558cc4SGreg Clayton // 599558cc4SGreg Clayton // This file is distributed under the University of Illinois Open Source 699558cc4SGreg Clayton // License. See LICENSE.TXT for details. 799558cc4SGreg Clayton // 899558cc4SGreg Clayton //===----------------------------------------------------------------------===// 999558cc4SGreg Clayton 1099558cc4SGreg Clayton #include "lldb/Symbol/CompilerDeclContext.h" 1199558cc4SGreg Clayton #include "lldb/Symbol/TypeSystem.h" 1299558cc4SGreg Clayton 1399558cc4SGreg Clayton using namespace lldb_private; 1499558cc4SGreg Clayton 1599558cc4SGreg Clayton bool 1699558cc4SGreg Clayton CompilerDeclContext::IsClang () const 1799558cc4SGreg Clayton { 18*f73034f9SGreg Clayton return IsValid() && m_type_system->getKind() == TypeSystem::eKindClang; 1999558cc4SGreg Clayton } 2099558cc4SGreg Clayton 2199558cc4SGreg Clayton ConstString 2299558cc4SGreg Clayton CompilerDeclContext::GetName () const 2399558cc4SGreg Clayton { 2499558cc4SGreg Clayton if (IsValid()) 2599558cc4SGreg Clayton return m_type_system->DeclContextGetName(m_opaque_decl_ctx); 2699558cc4SGreg Clayton else 2799558cc4SGreg Clayton return ConstString(); 2899558cc4SGreg Clayton } 2999558cc4SGreg Clayton 3099558cc4SGreg Clayton bool 3199558cc4SGreg Clayton CompilerDeclContext::IsStructUnionOrClass () const 3299558cc4SGreg Clayton { 3399558cc4SGreg Clayton if (IsValid()) 3499558cc4SGreg Clayton return m_type_system->DeclContextIsStructUnionOrClass(m_opaque_decl_ctx); 3599558cc4SGreg Clayton else 3699558cc4SGreg Clayton return false; 3799558cc4SGreg Clayton } 3899558cc4SGreg Clayton 3999558cc4SGreg Clayton bool 4099558cc4SGreg Clayton CompilerDeclContext::IsClassMethod (lldb::LanguageType *language_ptr, 4199558cc4SGreg Clayton bool *is_instance_method_ptr, 4299558cc4SGreg Clayton ConstString *language_object_name_ptr) 4399558cc4SGreg Clayton { 4499558cc4SGreg Clayton if (IsValid()) 4599558cc4SGreg Clayton return m_type_system->DeclContextIsClassMethod (m_opaque_decl_ctx, 4699558cc4SGreg Clayton language_ptr, 4799558cc4SGreg Clayton is_instance_method_ptr, 4899558cc4SGreg Clayton language_object_name_ptr); 4999558cc4SGreg Clayton else 5099558cc4SGreg Clayton return false; 5199558cc4SGreg Clayton } 5299558cc4SGreg Clayton 5399558cc4SGreg Clayton bool 5499558cc4SGreg Clayton lldb_private::operator == (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs) 5599558cc4SGreg Clayton { 5699558cc4SGreg Clayton return lhs.GetTypeSystem() == rhs.GetTypeSystem() && lhs.GetOpaqueDeclContext() == rhs.GetOpaqueDeclContext(); 5799558cc4SGreg Clayton } 5899558cc4SGreg Clayton 5999558cc4SGreg Clayton 6099558cc4SGreg Clayton bool 6199558cc4SGreg Clayton lldb_private::operator != (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs) 6299558cc4SGreg Clayton { 6399558cc4SGreg Clayton return lhs.GetTypeSystem() != rhs.GetTypeSystem() || lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext(); 6499558cc4SGreg Clayton } 65