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