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/CompilerDecl.h" 12 #include "lldb/Symbol/TypeSystem.h" 13 #include <vector> 14 15 using namespace lldb_private; 16 17 std::vector<CompilerDecl> 18 CompilerDeclContext::FindDeclByName (ConstString name, const bool ignore_using_decls) 19 { 20 if (IsValid()) 21 return m_type_system->DeclContextFindDeclByName( 22 m_opaque_decl_ctx, name, ignore_using_decls); 23 else 24 return std::vector<CompilerDecl>(); 25 } 26 27 bool 28 CompilerDeclContext::IsClang () const 29 { 30 return IsValid() && m_type_system->getKind() == TypeSystem::eKindClang; 31 } 32 33 ConstString 34 CompilerDeclContext::GetName () const 35 { 36 if (IsValid()) 37 return m_type_system->DeclContextGetName(m_opaque_decl_ctx); 38 else 39 return ConstString(); 40 } 41 42 ConstString 43 CompilerDeclContext::GetScopeQualifiedName () const 44 { 45 if (IsValid()) 46 return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx); 47 else 48 return ConstString(); 49 } 50 51 bool 52 CompilerDeclContext::IsStructUnionOrClass () const 53 { 54 if (IsValid()) 55 return m_type_system->DeclContextIsStructUnionOrClass(m_opaque_decl_ctx); 56 else 57 return false; 58 } 59 60 bool 61 CompilerDeclContext::IsClassMethod (lldb::LanguageType *language_ptr, 62 bool *is_instance_method_ptr, 63 ConstString *language_object_name_ptr) 64 { 65 if (IsValid()) 66 return m_type_system->DeclContextIsClassMethod (m_opaque_decl_ctx, 67 language_ptr, 68 is_instance_method_ptr, 69 language_object_name_ptr); 70 else 71 return false; 72 } 73 74 bool 75 lldb_private::operator == (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs) 76 { 77 return lhs.GetTypeSystem() == rhs.GetTypeSystem() && lhs.GetOpaqueDeclContext() == rhs.GetOpaqueDeclContext(); 78 } 79 80 81 bool 82 lldb_private::operator != (const lldb_private::CompilerDeclContext &lhs, const lldb_private::CompilerDeclContext &rhs) 83 { 84 return lhs.GetTypeSystem() != rhs.GetTypeSystem() || lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext(); 85 } 86