LLDB mainline
CompilerDeclContext.cpp
Go to the documentation of this file.
1//===-- CompilerDeclContext.cpp -------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
12#include <vector>
13
14using namespace lldb_private;
15
16std::vector<CompilerDecl>
18 const bool ignore_using_decls) {
19 if (IsValid())
20 return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name,
21 ignore_using_decls);
22 return std::vector<CompilerDecl>();
23}
24
26 if (IsValid())
27 return m_type_system->DeclContextGetName(m_opaque_decl_ctx);
28 return ConstString();
29}
30
32 if (IsValid())
33 return m_type_system->DeclContextGetScopeQualifiedName(m_opaque_decl_ctx);
34 return ConstString();
35}
36
38 if (IsValid())
39 return m_type_system->DeclContextIsClassMethod(m_opaque_decl_ctx);
40 return false;
41}
42
44 if (IsValid())
45 return m_type_system->DeclContextGetLanguage(m_opaque_decl_ctx);
46 return {};
47}
48
50 if (!IsValid())
51 return false;
52
53 // If the other context is just the current context, we don't need to go
54 // over the type system to know that the lookup is identical.
55 if (this == &other)
56 return true;
57
58 return m_type_system->DeclContextIsContainedInLookup(m_opaque_decl_ctx,
59 other.m_opaque_decl_ctx);
60}
61
62std::vector<lldb_private::CompilerContext>
64 if (IsValid())
65 return m_type_system->DeclContextGetCompilerContext(m_opaque_decl_ctx);
66 return {};
67}
68
74
Represents a generic declaration context in a program.
std::vector< CompilerDecl > FindDeclByName(ConstString name, const bool ignore_using_decls)
bool IsClassMethod()
Checks if this decl context represents a method of a class.
bool IsContainedInLookup(CompilerDeclContext other) const
Check if the given other decl context is contained in the lookup of this decl context (for example be...
CompilerDeclContext()=default
Constructs an invalid CompilerDeclContext.
lldb::LanguageType GetLanguage()
Determines the original language of the decl context.
std::vector< lldb_private::CompilerContext > GetCompilerContext() const
Populate a valid compiler context from the current decl context.
A uniqued constant string class.
Definition ConstString.h:40
A class that represents a running process on the host machine.
bool operator!=(const Address &lhs, const Address &rhs)
Definition Address.cpp:1017
bool operator==(const Address &lhs, const Address &rhs)
Definition Address.cpp:1011
LanguageType
Programming language type.