Path: blob/main/contrib/llvm-project/lldb/source/Symbol/CompilerDeclContext.cpp
39587 views
//===-- CompilerDeclContext.cpp -------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Symbol/CompilerDeclContext.h"9#include "lldb/Symbol/CompilerDecl.h"10#include "lldb/Symbol/TypeSystem.h"11#include <vector>1213using namespace lldb_private;1415std::vector<CompilerDecl>16CompilerDeclContext::FindDeclByName(ConstString name,17const bool ignore_using_decls) {18if (IsValid())19return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name,20ignore_using_decls);21return std::vector<CompilerDecl>();22}2324ConstString CompilerDeclContext::GetName() const {25if (IsValid())26return m_type_system->DeclContextGetName(m_opaque_decl_ctx);27return ConstString();28}2930ConstString CompilerDeclContext::GetScopeQualifiedName() const {31if (IsValid())32return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx);33return ConstString();34}3536bool CompilerDeclContext::IsClassMethod() {37if (IsValid())38return m_type_system->DeclContextIsClassMethod(m_opaque_decl_ctx);39return false;40}4142lldb::LanguageType CompilerDeclContext::GetLanguage() {43if (IsValid())44return m_type_system->DeclContextGetLanguage(m_opaque_decl_ctx);45return {};46}4748bool CompilerDeclContext::IsContainedInLookup(CompilerDeclContext other) const {49if (!IsValid())50return false;5152// If the other context is just the current context, we don't need to go53// over the type system to know that the lookup is identical.54if (this == &other)55return true;5657return m_type_system->DeclContextIsContainedInLookup(m_opaque_decl_ctx,58other.m_opaque_decl_ctx);59}6061std::vector<lldb_private::CompilerContext>62CompilerDeclContext::GetCompilerContext() const {63if (IsValid())64return m_type_system->DeclContextGetCompilerContext(m_opaque_decl_ctx);65return {};66}6768bool lldb_private::operator==(const lldb_private::CompilerDeclContext &lhs,69const lldb_private::CompilerDeclContext &rhs) {70return lhs.GetTypeSystem() == rhs.GetTypeSystem() &&71lhs.GetOpaqueDeclContext() == rhs.GetOpaqueDeclContext();72}7374bool lldb_private::operator!=(const lldb_private::CompilerDeclContext &lhs,75const lldb_private::CompilerDeclContext &rhs) {76return lhs.GetTypeSystem() != rhs.GetTypeSystem() ||77lhs.GetOpaqueDeclContext() != rhs.GetOpaqueDeclContext();78}798081