LLDB mainline
Type.cpp
Go to the documentation of this file.
1//===-- Type.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
9#include <cstdio>
10#include <optional>
11
12#include "lldb/Core/Module.h"
16#include "lldb/Utility/Log.h"
17#include "lldb/Utility/Scalar.h"
19
25#include "lldb/Symbol/Type.h"
28
30#include "lldb/Target/Process.h"
31#include "lldb/Target/Target.h"
32
33#include "llvm/ADT/StringRef.h"
34
35using namespace lldb;
36using namespace lldb_private;
37
38bool lldb_private::contextMatches(llvm::ArrayRef<CompilerContext> context_chain,
39 llvm::ArrayRef<CompilerContext> pattern) {
40 auto ctx = context_chain.begin();
41 auto ctx_end = context_chain.end();
42 for (const CompilerContext &pat : pattern) {
43 // Early exit if the pattern is too long.
44 if (ctx == ctx_end)
45 return false;
46 if (*ctx != pat) {
47 // Skip any number of module matches.
48 if (pat.kind == CompilerContextKind::AnyModule) {
49 // Greedily match 0..n modules.
50 ctx = std::find_if(ctx, ctx_end, [](const CompilerContext &ctx) {
51 return ctx.kind != CompilerContextKind::Module;
52 });
53 continue;
54 }
55 // See if there is a kind mismatch; they should have 1 bit in common.
56 if (((uint16_t)ctx->kind & (uint16_t)pat.kind) == 0)
57 return false;
58 // The name is ignored for AnyModule, but not for AnyType.
59 if (pat.kind != CompilerContextKind::AnyModule && ctx->name != pat.name)
60 return false;
61 }
62 ++ctx;
63 }
64 return true;
65}
66
67static CompilerContextKind ConvertTypeClass(lldb::TypeClass type_class) {
68 if (type_class == eTypeClassAny)
69 return CompilerContextKind::AnyType;
70 uint16_t result = 0;
71 if (type_class & lldb::eTypeClassClass)
72 result |= (uint16_t)CompilerContextKind::Class;
73 if (type_class & lldb::eTypeClassStruct)
74 result |= (uint16_t)CompilerContextKind::Struct;
75 if (type_class & lldb::eTypeClassUnion)
76 result |= (uint16_t)CompilerContextKind::Union;
77 if (type_class & lldb::eTypeClassEnumeration)
78 result |= (uint16_t)CompilerContextKind::Enum;
79 if (type_class & lldb::eTypeClassFunction)
80 result |= (uint16_t)CompilerContextKind::Function;
81 if (type_class & lldb::eTypeClassTypedef)
82 result |= (uint16_t)CompilerContextKind::Typedef;
83 return (CompilerContextKind)result;
84}
85
86TypeQuery::TypeQuery(llvm::StringRef name, TypeQueryOptions options)
87 : m_options(options) {
88 llvm::StringRef scope, basename;
89 lldb::TypeClass type_class = lldb::eTypeClassAny;
90 if (Type::GetTypeScopeAndBasename(name, scope, basename, type_class)) {
91 if (scope.consume_front("::"))
92 m_options |= e_exact_match;
93 if (!scope.empty()) {
94 std::pair<llvm::StringRef, llvm::StringRef> scope_pair =
95 scope.split("::");
96 while (!scope_pair.second.empty()) {
98 ConstString(scope_pair.first.str())});
99 scope_pair = scope_pair.second.split("::");
100 }
102 ConstString(scope_pair.first.str())});
103 }
104 m_context.push_back(
105 {ConvertTypeClass(type_class), ConstString(basename.str())});
106 } else {
107 m_context.push_back(
109 }
110}
111
113 ConstString type_basename, TypeQueryOptions options)
114 : m_options(options) {
115 // Always use an exact match if we are looking for a type in compiler context.
116 m_options |= e_exact_match;
117 m_context = decl_ctx.GetCompilerContext();
118 m_context.push_back({CompilerContextKind::AnyType, type_basename});
119}
120
122 const llvm::ArrayRef<lldb_private::CompilerContext> &context,
123 TypeQueryOptions options)
124 : m_context(context), m_options(options) {
125 // Always use an exact match if we are looking for a type in compiler context.
126 m_options |= e_exact_match;
127}
128
129TypeQuery::TypeQuery(const CompilerDecl &decl, TypeQueryOptions options)
130 : m_options(options) {
131 // Always for an exact match if we are looking for a type using a declaration.
132 m_options |= e_exact_match;
134}
135
137 if (m_context.empty())
138 return ConstString();
139 return m_context.back().name;
140}
141
143 if (!m_languages)
145 m_languages->Insert(language);
146}
147
149 m_languages = std::move(languages);
150}
151
153 llvm::ArrayRef<CompilerContext> context_chain) const {
154 if (GetExactMatch() || context_chain.size() == m_context.size())
155 return ::contextMatches(context_chain, m_context);
156
157 // We don't have an exact match, we need to bottom m_context.size() items to
158 // match for a successful lookup.
159 if (context_chain.size() < m_context.size())
160 return false; // Not enough items in context_chain to allow for a match.
161
162 size_t compare_count = context_chain.size() - m_context.size();
163 return ::contextMatches(
164 llvm::ArrayRef<CompilerContext>(context_chain.data() + compare_count,
165 m_context.size()),
166 m_context);
167}
168
170 // If we have no language filterm language always matches.
171 if (!m_languages.has_value())
172 return true;
173 return (*m_languages)[language];
174}
175
177 return !m_searched_symbol_files.insert(sym_file).second;
178}
179
181 if (type_sp)
182 return m_type_map.InsertUnique(type_sp);
183 return false;
184}
185
186bool TypeResults::Done(const TypeQuery &query) const {
187 if (query.GetFindOne())
188 return !m_type_map.Empty();
189 return false;
190}
191
193 switch (kind) {
194 default:
195 s << "Invalid";
196 break;
198 s << "TranslationUnit";
199 break;
201 s << "Module";
202 break;
204 s << "Namespace";
205 break;
207 s << "Class";
208 break;
210 s << "Structure";
211 break;
213 s << "Union";
214 break;
216 s << "Function";
217 break;
219 s << "Variable";
220 break;
222 s << "Enumeration";
223 break;
225 s << "Typedef";
226 break;
228 s << "AnyModule";
229 break;
231 s << "AnyType";
232 break;
233 }
234 s << "(" << name << ")";
235}
236
238public:
239 TypeAppendVisitor(TypeListImpl &type_list) : m_type_list(type_list) {}
240
241 bool operator()(const lldb::TypeSP &type) {
242 m_type_list.Append(TypeImplSP(new TypeImpl(type)));
243 return true;
244 }
245
246private:
248};
249
251 TypeAppendVisitor cb(*this);
252 type_list.ForEach(cb);
253}
254
256 const lldb::TypeSP &type_sp)
257 : UserID(type_sp ? type_sp->GetID() : LLDB_INVALID_UID),
258 m_symbol_file(symbol_file), m_type_sp(type_sp) {}
259
261 if (!m_type_sp) {
262 Type *resolved_type = m_symbol_file.ResolveTypeUID(GetID());
263 if (resolved_type)
264 m_type_sp = resolved_type->shared_from_this();
265 }
266 return m_type_sp.get();
267}
268
270 std::optional<uint64_t> byte_size, SymbolContextScope *context,
271 user_id_t encoding_uid, EncodingDataType encoding_uid_type,
272 const Declaration &decl, const CompilerType &compiler_type,
273 ResolveState compiler_type_resolve_state, uint32_t opaque_payload)
274 : std::enable_shared_from_this<Type>(), UserID(uid), m_name(name),
275 m_symbol_file(symbol_file), m_context(context),
276 m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type),
277 m_decl(decl), m_compiler_type(compiler_type),
278 m_compiler_type_resolve_state(compiler_type ? compiler_type_resolve_state
279 : ResolveState::Unresolved),
280 m_payload(opaque_payload) {
281 if (byte_size) {
282 m_byte_size = *byte_size;
284 } else {
285 m_byte_size = 0;
286 m_byte_size_has_value = false;
287 }
288}
289
291 : std::enable_shared_from_this<Type>(), UserID(0), m_name("<INVALID TYPE>"),
292 m_payload(0) {
293 m_byte_size = 0;
294 m_byte_size_has_value = false;
295}
296
298 bool show_name, ExecutionContextScope *exe_scope) {
299 *s << "id = " << (const UserID &)*this;
300
301 // Call the name accessor to make sure we resolve the type name
302 if (show_name) {
303 ConstString type_name = GetName();
304 if (type_name) {
305 *s << ", name = \"" << type_name << '"';
306 ConstString qualified_type_name(GetQualifiedName());
307 if (qualified_type_name != type_name) {
308 *s << ", qualified = \"" << qualified_type_name << '"';
309 }
310 }
311 }
312
313 // Call the get byte size accessor so we resolve our byte size
314 if (GetByteSize(exe_scope))
315 s->Printf(", byte-size = %" PRIu64, m_byte_size);
316 bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
317 m_decl.Dump(s, show_fullpaths);
318
319 if (m_compiler_type.IsValid()) {
320 *s << ", compiler_type = \"";
322 *s << '"';
323 } else if (m_encoding_uid != LLDB_INVALID_UID) {
324 s->Printf(", type_uid = 0x%8.8" PRIx64, m_encoding_uid);
325 switch (m_encoding_uid_type) {
326 case eEncodingInvalid:
327 break;
328 case eEncodingIsUID:
329 s->PutCString(" (unresolved type)");
330 break;
332 s->PutCString(" (unresolved const type)");
333 break;
335 s->PutCString(" (unresolved restrict type)");
336 break;
338 s->PutCString(" (unresolved volatile type)");
339 break;
341 s->PutCString(" (unresolved atomic type)");
342 break;
344 s->PutCString(" (unresolved typedef)");
345 break;
347 s->PutCString(" (unresolved pointer)");
348 break;
350 s->PutCString(" (unresolved L value reference)");
351 break;
353 s->PutCString(" (unresolved R value reference)");
354 break;
356 s->PutCString(" (synthetic type)");
357 break;
358 }
359 }
360}
361
362void Type::Dump(Stream *s, bool show_context, lldb::DescriptionLevel level) {
363 s->Printf("%p: ", static_cast<void *>(this));
364 s->Indent();
365 *s << "Type" << static_cast<const UserID &>(*this) << ' ';
366 if (m_name)
367 *s << ", name = \"" << m_name << "\"";
368
370 s->Printf(", size = %" PRIu64, m_byte_size);
371
372 if (show_context && m_context != nullptr) {
373 s->PutCString(", context = ( ");
375 s->PutCString(" )");
376 }
377
378 bool show_fullpaths = false;
379 m_decl.Dump(s, show_fullpaths);
380
381 if (m_compiler_type.IsValid()) {
382 *s << ", compiler_type = " << m_compiler_type.GetOpaqueQualType() << ' ';
384 } else if (m_encoding_uid != LLDB_INVALID_UID) {
385 s->Format(", type_data = {0:x-16}", m_encoding_uid);
386 switch (m_encoding_uid_type) {
387 case eEncodingInvalid:
388 break;
389 case eEncodingIsUID:
390 s->PutCString(" (unresolved type)");
391 break;
393 s->PutCString(" (unresolved const type)");
394 break;
396 s->PutCString(" (unresolved restrict type)");
397 break;
399 s->PutCString(" (unresolved volatile type)");
400 break;
402 s->PutCString(" (unresolved atomic type)");
403 break;
405 s->PutCString(" (unresolved typedef)");
406 break;
408 s->PutCString(" (unresolved pointer)");
409 break;
411 s->PutCString(" (unresolved L value reference)");
412 break;
414 s->PutCString(" (unresolved R value reference)");
415 break;
417 s->PutCString(" (synthetic type)");
418 break;
419 }
420 }
421
422 //
423 // if (m_access)
424 // s->Printf(", access = %u", m_access);
425 s->EOL();
426}
427
429 if (!m_name)
431 return m_name;
432}
433
435 return GetForwardCompilerType().GetTypeName(/*BaseOnly*/ true);
436}
437
438void Type::DumpTypeName(Stream *s) { GetName().Dump(s, "<invalid-type-name>"); }
439
443 return m_encoding_type;
444}
445
446std::optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
448 return static_cast<uint64_t>(m_byte_size);
449
450 switch (m_encoding_uid_type) {
451 case eEncodingInvalid:
453 break;
454 case eEncodingIsUID:
460 Type *encoding_type = GetEncodingType();
461 if (encoding_type)
462 if (std::optional<uint64_t> size =
463 encoding_type->GetByteSize(exe_scope)) {
464 m_byte_size = *size;
466 return static_cast<uint64_t>(m_byte_size);
467 }
468
469 if (std::optional<uint64_t> size =
470 GetLayoutCompilerType().GetByteSize(exe_scope)) {
471 m_byte_size = *size;
473 return static_cast<uint64_t>(m_byte_size);
474 }
475 } break;
476
477 // If we are a pointer or reference, then this is just a pointer size;
482 m_byte_size = arch.GetAddressByteSize();
484 return static_cast<uint64_t>(m_byte_size);
485 }
486 } break;
487 }
488 return {};
489}
490
491llvm::Expected<uint32_t> Type::GetNumChildren(bool omit_empty_base_classes) {
492 return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr);
493}
494
497}
498
501}
502
504 lldb::TypeSP type_sp;
505 if (IsTypedef()) {
507 if (typedef_type)
508 type_sp = typedef_type->shared_from_this();
509 }
510 return type_sp;
511}
512
514
516 // Make sure we resolve our type if it already hasn't been.
517 return GetForwardCompilerType().GetEncoding(count);
518}
519
521 AddressType address_type, DataExtractor &data) {
522 if (address_type == eAddressTypeFile) {
523 // Can't convert a file address to anything valid without more context
524 // (which Module it came from)
525 return false;
526 }
527
528 const uint64_t byte_size =
529 GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
530 .value_or(0);
531 if (data.GetByteSize() < byte_size) {
532 lldb::DataBufferSP data_sp(new DataBufferHeap(byte_size, '\0'));
533 data.SetData(data_sp);
534 }
535
536 uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
537 if (dst != nullptr) {
538 if (address_type == eAddressTypeHost) {
539 // The address is an address in this process, so just copy it
540 if (addr == 0)
541 return false;
542 memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
543 return true;
544 } else {
545 if (exe_ctx) {
546 Process *process = exe_ctx->GetProcessPtr();
547 if (process) {
549 return exe_ctx->GetProcessPtr()->ReadMemory(addr, dst, byte_size,
550 error) == byte_size;
551 }
552 }
553 }
554 }
555 return false;
556}
557
559 AddressType address_type, DataExtractor &data) {
560 return false;
561}
562
563const Declaration &Type::GetDeclaration() const { return m_decl; }
564
565bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) {
566 // TODO: This needs to consider the correct type system to use.
567 Type *encoding_type = nullptr;
568 if (!m_compiler_type.IsValid()) {
569 encoding_type = GetEncodingType();
570 if (encoding_type) {
571 switch (m_encoding_uid_type) {
572 case eEncodingIsUID: {
573 CompilerType encoding_compiler_type =
574 encoding_type->GetForwardCompilerType();
575 if (encoding_compiler_type.IsValid()) {
576 m_compiler_type = encoding_compiler_type;
578 encoding_type->m_compiler_type_resolve_state;
579 }
580 } break;
581
584 encoding_type->GetForwardCompilerType().AddConstModifier();
585 break;
586
590 break;
591
595 break;
596
599 encoding_type->GetForwardCompilerType().GetAtomicType();
600 break;
601
604 m_name.AsCString("__lldb_invalid_typedef_name"),
605 GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
606 m_name.Clear();
607 break;
608
611 encoding_type->GetForwardCompilerType().GetPointerType();
612 break;
613
617 break;
618
622 break;
623
624 default:
625 llvm_unreachable("Unhandled encoding_data_type.");
626 }
627 } else {
628 // We have no encoding type, return void?
629 auto type_system_or_err =
631 if (auto err = type_system_or_err.takeError()) {
633 GetLog(LLDBLog::Symbols), std::move(err),
634 "Unable to construct void type from TypeSystemClang: {0}");
635 } else {
636 CompilerType void_compiler_type;
637 auto ts = *type_system_or_err;
638 if (ts)
639 void_compiler_type = ts->GetBasicTypeFromAST(eBasicTypeVoid);
640 switch (m_encoding_uid_type) {
641 case eEncodingIsUID:
642 m_compiler_type = void_compiler_type;
643 break;
644
646 m_compiler_type = void_compiler_type.AddConstModifier();
647 break;
648
650 m_compiler_type = void_compiler_type.AddRestrictModifier();
651 break;
652
654 m_compiler_type = void_compiler_type.AddVolatileModifier();
655 break;
656
658 m_compiler_type = void_compiler_type.GetAtomicType();
659 break;
660
662 m_compiler_type = void_compiler_type.CreateTypedef(
663 m_name.AsCString("__lldb_invalid_typedef_name"),
664 GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
665 break;
666
668 m_compiler_type = void_compiler_type.GetPointerType();
669 break;
670
672 m_compiler_type = void_compiler_type.GetLValueReferenceType();
673 break;
674
676 m_compiler_type = void_compiler_type.GetRValueReferenceType();
677 break;
678
679 default:
680 llvm_unreachable("Unhandled encoding_data_type.");
681 }
682 }
683 }
684
685 // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is
686 // set to eResolveStateUnresolved so we need to update it to say that we
687 // now have a forward declaration since that is what we created above.
690 }
691
692 // Check if we have a forward reference to a class/struct/union/enum?
693 if (compiler_type_resolve_state == ResolveState::Layout ||
694 compiler_type_resolve_state == ResolveState::Full) {
695 // Check if we have a forward reference to a class/struct/union/enum?
696 if (m_compiler_type.IsValid() &&
697 m_compiler_type_resolve_state < compiler_type_resolve_state) {
699 if (!m_compiler_type.IsDefined()) {
700 // We have a forward declaration, we need to resolve it to a complete
701 // definition.
703 }
704 }
705 }
706
707 // If we have an encoding type, then we need to make sure it is resolved
708 // appropriately.
710 if (encoding_type == nullptr)
711 encoding_type = GetEncodingType();
712 if (encoding_type) {
713 ResolveState encoding_compiler_type_resolve_state =
714 compiler_type_resolve_state;
715
716 if (compiler_type_resolve_state == ResolveState::Layout) {
717 switch (m_encoding_uid_type) {
721 encoding_compiler_type_resolve_state = ResolveState::Forward;
722 break;
723 default:
724 break;
725 }
726 }
727 encoding_type->ResolveCompilerType(encoding_compiler_type_resolve_state);
728 }
729 }
730 return m_compiler_type.IsValid();
731}
733 uint32_t encoding_mask = 1u << m_encoding_uid_type;
734 Type *encoding_type = GetEncodingType();
735 assert(encoding_type != this);
736 if (encoding_type)
737 encoding_mask |= encoding_type->GetEncodingMask();
738 return encoding_mask;
739}
740
743 return m_compiler_type;
744}
745
748 return m_compiler_type;
749}
750
753 return m_compiler_type;
754}
755
758}
759
760bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
761 llvm::StringRef &scope,
762 llvm::StringRef &basename,
763 TypeClass &type_class) {
764 type_class = eTypeClassAny;
765
766 if (name.empty())
767 return false;
768
769 // Clear the scope in case we have just a type class and a basename.
770 scope = llvm::StringRef();
771 basename = name;
772 if (basename.consume_front("struct "))
773 type_class = eTypeClassStruct;
774 else if (basename.consume_front("class "))
775 type_class = eTypeClassClass;
776 else if (basename.consume_front("union "))
777 type_class = eTypeClassUnion;
778 else if (basename.consume_front("enum "))
779 type_class = eTypeClassEnumeration;
780 else if (basename.consume_front("typedef "))
781 type_class = eTypeClassTypedef;
782
783 size_t namespace_separator = basename.find("::");
784 if (namespace_separator == llvm::StringRef::npos) {
785 // If "name" started a type class we need to return true with no scope.
786 return type_class != eTypeClassAny;
787 }
788
789 size_t template_begin = basename.find('<');
790 while (namespace_separator != llvm::StringRef::npos) {
791 if (template_begin != llvm::StringRef::npos &&
792 namespace_separator > template_begin) {
793 size_t template_depth = 1;
794 llvm::StringRef template_arg =
795 basename.drop_front(template_begin + 1);
796 while (template_depth > 0 && !template_arg.empty()) {
797 if (template_arg.front() == '<')
798 template_depth++;
799 else if (template_arg.front() == '>')
800 template_depth--;
801 template_arg = template_arg.drop_front(1);
802 }
803 if (template_depth != 0)
804 return false; // We have an invalid type name. Bail out.
805 if (template_arg.empty())
806 break; // The template ends at the end of the full name.
807 basename = template_arg;
808 } else {
809 basename = basename.drop_front(namespace_separator + 2);
810 }
811 template_begin = basename.find('<');
812 namespace_separator = basename.find("::");
813 }
814 if (basename.size() < name.size()) {
815 scope = name.take_front(name.size() - basename.size());
816 return true;
817 }
818 return false;
819}
820
822 if (m_symbol_file)
824 return ModuleSP();
825}
826
828 if (m_compiler_type) {
829 auto ts = m_compiler_type.GetTypeSystem();
830 if (!ts)
831 return {};
832 SymbolFile *symbol_file = ts->GetSymbolFile();
833 if (symbol_file)
834 return symbol_file->GetObjectFile()->GetModule();
835 }
836 return {};
837}
838
840 if (in_type_sp) {
841 m_compiler_type = in_type_sp->GetForwardCompilerType();
842 m_type_name = in_type_sp->GetName();
843 }
844}
845
846TypeAndOrName::TypeAndOrName(const char *in_type_str)
847 : m_type_name(in_type_str) {}
848
850 : m_type_name(in_type_const_string) {}
851
852bool TypeAndOrName::operator==(const TypeAndOrName &other) const {
853 if (m_compiler_type != other.m_compiler_type)
854 return false;
855 if (m_type_name != other.m_type_name)
856 return false;
857 return true;
858}
859
860bool TypeAndOrName::operator!=(const TypeAndOrName &other) const {
861 return !(*this == other);
862}
863
865 if (m_type_name)
866 return m_type_name;
867 if (m_compiler_type)
869 return ConstString("<invalid>");
870}
871
873 m_type_name = type_name;
874}
875
876void TypeAndOrName::SetName(const char *type_name_cstr) {
877 m_type_name.SetCString(type_name_cstr);
878}
879
880void TypeAndOrName::SetName(llvm::StringRef type_name) {
881 m_type_name.SetString(type_name);
882}
883
885 if (type_sp) {
886 m_compiler_type = type_sp->GetForwardCompilerType();
887 m_type_name = type_sp->GetName();
888 } else
889 Clear();
890}
891
893 m_compiler_type = compiler_type;
894 if (m_compiler_type)
896}
897
899 return !((bool)m_type_name || (bool)m_compiler_type);
900}
901
905}
906
907bool TypeAndOrName::HasName() const { return (bool)m_type_name; }
908
910 return m_compiler_type.IsValid();
911}
912
914 : m_module_wp(), m_static_type(), m_dynamic_type() {
915 SetType(type_sp);
916}
917
918TypeImpl::TypeImpl(const CompilerType &compiler_type)
919 : m_module_wp(), m_static_type(), m_dynamic_type() {
920 SetType(compiler_type);
921}
922
923TypeImpl::TypeImpl(const lldb::TypeSP &type_sp, const CompilerType &dynamic)
924 : m_module_wp(), m_static_type(), m_dynamic_type(dynamic) {
925 SetType(type_sp, dynamic);
926}
927
929 const CompilerType &dynamic_type)
930 : m_module_wp(), m_static_type(), m_dynamic_type() {
931 SetType(static_type, dynamic_type);
932}
933
934void TypeImpl::SetType(const lldb::TypeSP &type_sp) {
935 if (type_sp) {
936 m_static_type = type_sp->GetForwardCompilerType();
937 m_exe_module_wp = type_sp->GetExeModule();
938 m_module_wp = type_sp->GetModule();
939 } else {
942 }
943}
944
945void TypeImpl::SetType(const CompilerType &compiler_type) {
947 m_static_type = compiler_type;
948}
949
950void TypeImpl::SetType(const lldb::TypeSP &type_sp,
951 const CompilerType &dynamic) {
952 SetType(type_sp);
953 m_dynamic_type = dynamic;
954}
955
956void TypeImpl::SetType(const CompilerType &compiler_type,
957 const CompilerType &dynamic) {
959 m_static_type = compiler_type;
960 m_dynamic_type = dynamic;
961}
962
963bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const {
964 return CheckModuleCommon(m_module_wp, module_sp);
965}
966
968 return CheckModuleCommon(m_exe_module_wp, module_sp);
969}
970
971bool TypeImpl::CheckModuleCommon(const lldb::ModuleWP &input_module_wp,
972 lldb::ModuleSP &module_sp) const {
973 // Check if we have a module for this type. If we do and the shared pointer
974 // is can be successfully initialized with m_module_wp, return true. Else
975 // return false if we didn't have a module, or if we had a module and it has
976 // been deleted. Any functions doing anything with a TypeSP in this TypeImpl
977 // class should call this function and only do anything with the ivars if
978 // this function returns true. If we have a module, the "module_sp" will be
979 // filled in with a strong reference to the module so that the module will at
980 // least stay around long enough for the type query to succeed.
981 module_sp = input_module_wp.lock();
982 if (!module_sp) {
983 lldb::ModuleWP empty_module_wp;
984 // If either call to "std::weak_ptr::owner_before(...) value returns true,
985 // this indicates that m_module_wp once contained (possibly still does) a
986 // reference to a valid shared pointer. This helps us know if we had a
987 // valid reference to a section which is now invalid because the module it
988 // was in was deleted
989 if (empty_module_wp.owner_before(input_module_wp) ||
990 input_module_wp.owner_before(empty_module_wp)) {
991 // input_module_wp had a valid reference to a module, but all strong
992 // references have been released and the module has been deleted
993 return false;
994 }
995 }
996 // We either successfully locked the module, or didn't have one to begin with
997 return true;
998}
999
1000bool TypeImpl::operator==(const TypeImpl &rhs) const {
1001 return m_static_type == rhs.m_static_type &&
1003}
1004
1005bool TypeImpl::operator!=(const TypeImpl &rhs) const {
1006 return !(*this == rhs);
1007}
1008
1009bool TypeImpl::IsValid() const {
1010 // just a name is not valid
1011 ModuleSP module_sp;
1012 if (CheckModule(module_sp))
1014 return false;
1015}
1016
1017TypeImpl::operator bool() const { return IsValid(); }
1018
1023}
1024
1026 lldb::ModuleSP module_sp;
1027 if (CheckExeModule(module_sp))
1028 return module_sp;
1029 return nullptr;
1030}
1031
1033 ModuleSP module_sp;
1034 if (CheckModule(module_sp)) {
1035 if (m_dynamic_type)
1036 return m_dynamic_type.GetTypeName();
1037 return m_static_type.GetTypeName();
1038 }
1039 return ConstString();
1040}
1041
1043 ModuleSP module_sp;
1044 if (CheckModule(module_sp)) {
1045 if (m_dynamic_type)
1048 }
1049 return ConstString();
1050}
1051
1053 ModuleSP module_sp;
1054 if (CheckModule(module_sp)) {
1055 if (m_dynamic_type.IsValid()) {
1058 }
1060 }
1061 return TypeImpl();
1062}
1063
1065 ModuleSP module_sp;
1066 if (CheckModule(module_sp)) {
1067 if (m_dynamic_type.IsValid()) {
1070 }
1072 }
1073 return TypeImpl();
1074}
1075
1077 ModuleSP module_sp;
1078 if (CheckModule(module_sp)) {
1079 if (m_dynamic_type.IsValid()) {
1082 }
1084 }
1085 return TypeImpl();
1086}
1087
1089 ModuleSP module_sp;
1090 if (CheckModule(module_sp)) {
1091 if (m_dynamic_type.IsValid()) {
1094 }
1096 }
1097 return TypeImpl();
1098}
1099
1101 ModuleSP module_sp;
1102 if (CheckModule(module_sp)) {
1103 if (m_dynamic_type.IsValid()) {
1106 }
1108 }
1109 return TypeImpl();
1110}
1111
1113 ModuleSP module_sp;
1114 if (CheckModule(module_sp)) {
1115 if (m_dynamic_type.IsValid()) {
1118 }
1120 }
1121 return TypeImpl();
1122}
1123
1125 ModuleSP module_sp;
1126 if (CheckModule(module_sp)) {
1127 if (m_dynamic_type.IsValid()) {
1130 }
1132 }
1133 return TypeImpl();
1134}
1135
1137 ModuleSP module_sp;
1138 if (CheckModule(module_sp)) {
1139 if (prefer_dynamic) {
1140 if (m_dynamic_type.IsValid())
1141 return m_dynamic_type;
1142 }
1143 return m_static_type;
1144 }
1145 return CompilerType();
1146}
1147
1149 ModuleSP module_sp;
1150 if (CheckModule(module_sp)) {
1151 if (prefer_dynamic) {
1152 if (m_dynamic_type.IsValid())
1154 }
1156 }
1157 return {};
1158}
1159
1161 lldb::DescriptionLevel description_level) {
1162 ModuleSP module_sp;
1163 if (CheckModule(module_sp)) {
1164 if (m_dynamic_type.IsValid()) {
1165 strm.Printf("Dynamic:\n");
1167 strm.Printf("\nStatic:\n");
1168 }
1170 } else {
1171 strm.PutCString("Invalid TypeImpl module for type has been deleted\n");
1172 }
1173 return true;
1174}
1175
1177 if (name.empty())
1178 return CompilerType();
1179 auto type_system = GetTypeSystem(/*prefer_dynamic*/ false);
1180 auto *symbol_file = type_system->GetSymbolFile();
1181 if (!symbol_file)
1182 return CompilerType();
1183 auto decl_context = type_system->GetCompilerDeclContextForType(m_static_type);
1184 if (!decl_context.IsValid())
1185 return CompilerType();
1186 TypeQuery query(decl_context, ConstString(name),
1187 TypeQueryOptions::e_find_one);
1188 TypeResults results;
1189 symbol_file->FindTypes(query, results);
1190 TypeSP type_sp = results.GetFirstType();
1191 if (type_sp)
1192 return type_sp->GetFullCompilerType();
1193 return CompilerType();
1194}
1195
1198}
1199
1201
1203 return m_decl.GetMangledName();
1204}
1205
1207
1209 return m_kind;
1210}
1211
1213 switch (m_kind) {
1215 return false;
1217 stream.Printf("constructor for %s",
1218 m_type.GetTypeName().AsCString("<unknown>"));
1219 break;
1221 stream.Printf("destructor for %s",
1222 m_type.GetTypeName().AsCString("<unknown>"));
1223 break;
1225 stream.Printf("instance method %s of type %s", m_name.AsCString(),
1227 break;
1229 stream.Printf("static method %s of type %s", m_name.AsCString(),
1231 break;
1232 }
1233 return true;
1234}
1235
1237 if (m_type)
1240}
1241
1243 if (m_type)
1245 else
1247}
1248
1250 if (m_type)
1252 else
1253 return m_decl.GetFunctionArgumentType(idx);
1254}
1255
1257 ConstString name,
1258 const llvm::APSInt &value)
1259 : m_integer_type_sp(integer_type_sp), m_name(name), m_value(value),
1260 m_valid((bool)name && (bool)integer_type_sp)
1261
1262{}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERROR(log, error,...)
Definition: Log.h:365
static CompilerContextKind ConvertTypeClass(lldb::TypeClass type_class)
Definition: Type.cpp:67
bool operator()(const lldb::TypeSP &type)
Definition: Type.cpp:241
TypeListImpl & m_type_list
Definition: Type.cpp:247
TypeAppendVisitor(TypeListImpl &type_list)
Definition: Type.cpp:239
An architecture specification class.
Definition: ArchSpec.h:31
Represents a generic declaration context in a program.
std::vector< lldb_private::CompilerContext > GetCompilerContext() const
Populate a valid compiler context from the current decl context.
Represents a generic declaration such as a function declaration.
Definition: CompilerDecl.h:28
ConstString GetMangledName() const
CompilerType GetFunctionArgumentType(size_t arg_idx) const
CompilerType GetFunctionReturnType() const
CompilerDeclContext GetDeclContext() const
size_t GetNumFunctionArguments() const
std::vector< lldb_private::CompilerContext > GetCompilerContext() const
Populate a valid compiler context from the current declaration.
This is a minimal wrapper of a TypeSystem shared pointer as returned by CompilerType which conventien...
Definition: CompilerType.h:49
Generic representation of a type in a programming language.
Definition: CompilerType.h:36
TypeSystemSPWrapper GetTypeSystem() const
Accessors.
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
CompilerType AddConstModifier() const
Return a new CompilerType adds a const modifier to this type if this type is valid and the type syste...
lldb::Encoding GetEncoding(uint64_t &count) const
ConstString GetDisplayTypeName() const
CompilerType GetRValueReferenceType() const
Return a new CompilerType that is a R value reference to this type if this type is valid and the type...
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
lldb::opaque_compiler_type_t GetOpaqueQualType() const
Definition: CompilerType.h:281
CompilerType AddVolatileModifier() const
Return a new CompilerType adds a volatile modifier to this type if this type is valid and the type sy...
CompilerType AddRestrictModifier() const
Return a new CompilerType adds a restrict modifier to this type if this type is valid and the type sy...
CompilerType GetFunctionArgumentAtIndex(const size_t index) const
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
size_t GetNumberOfFunctionArguments() const
CompilerType GetNonReferenceType() const
If this type is a reference to a type (L value or R value reference), return a new type with the refe...
ConstString GetTypeName(bool BaseOnly=false) const
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
lldb::Format GetFormat() const
CompilerType GetFullyUnqualifiedType() const
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const
CompilerType CreateTypedef(const char *name, const CompilerDeclContext &decl_ctx, uint32_t payload) const
Create a typedef to this type using "name" as the name of the typedef this type is valid and the type...
CompilerType GetFunctionReturnType() const
CompilerType GetAtomicType() const
Return a new CompilerType that is the atomic type of this type.
CompilerType GetCanonicalType() const
void DumpTypeDescription(lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) const
Dump to stdout.
A uniqued constant string class.
Definition: ConstString.h:40
void SetCString(const char *cstr)
Set the C string value.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:188
void Dump(Stream *s, const char *value_if_empty=nullptr) const
Dump the object description to a stream.
void SetString(llvm::StringRef s)
void Clear()
Clear this object's state.
Definition: ConstString.h:230
A subclass of DataBuffer that stores a data buffer on the heap.
An data extractor class.
Definition: DataExtractor.h:48
const uint8_t * PeekData(lldb::offset_t offset, lldb::offset_t length) const
Peek at a bytes at offset.
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
A class that describes the declaration location of a lldb object.
Definition: Declaration.h:24
void Dump(Stream *s, bool show_fullpaths) const
Dump a description of this object to a Stream.
Definition: Declaration.cpp:14
"lldb/Target/ExecutionContextScope.h" Inherit from this if your object can reconstruct its execution ...
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
ExecutionContextScope * GetBestExecutionContextScope() const
Process * GetProcessPtr() const
Returns a pointer to the process object.
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
virtual ArchSpec GetArchitecture()=0
Get the ArchSpec for this object file.
A plug-in interface definition class for debugging a process.
Definition: Process.h:340
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
Definition: Process.cpp:1938
An error handling class.
Definition: Status.h:44
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
void Format(const char *format, Args &&... args)
Definition: Stream.h:353
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:157
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:65
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:155
"lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is part of a symbol context and c...
virtual void DumpSymbolContext(Stream *s)=0
Dump the object's symbol context to the stream s.
SymbolFile & m_symbol_file
Definition: Type.h:373
SymbolFileType(SymbolFile &symbol_file, lldb::user_id_t uid)
Definition: Type.h:360
lldb::TypeSP m_type_sp
Definition: Type.h:374
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:50
virtual bool CompleteType(CompilerType &compiler_type)=0
virtual Type * ResolveTypeUID(lldb::user_id_t type_uid)=0
virtual llvm::Expected< lldb::TypeSystemSP > GetTypeSystemForLanguage(lldb::LanguageType language)=0
virtual ObjectFile * GetObjectFile()=0
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:712
void SetName(ConstString type_name)
Definition: Type.cpp:872
bool operator!=(const TypeAndOrName &other) const
Definition: Type.cpp:860
bool operator==(const TypeAndOrName &other) const
Definition: Type.cpp:852
bool HasName() const
Definition: Type.cpp:907
ConstString GetName() const
Definition: Type.cpp:864
bool HasCompilerType() const
Definition: Type.cpp:909
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:892
ConstString m_type_name
Definition: Type.h:752
void SetTypeSP(lldb::TypeSP type_sp)
Definition: Type.cpp:884
CompilerType m_compiler_type
Definition: Type.h:751
bool IsEmpty() const
Definition: Type.cpp:898
CompilerType GetCompilerType(bool prefer_dynamic)
Definition: Type.cpp:1136
bool operator!=(const TypeImpl &rhs) const
Definition: Type.cpp:1005
bool CheckExeModule(lldb::ModuleSP &module_sp) const
Definition: Type.cpp:967
bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level)
Definition: Type.cpp:1160
bool operator==(const TypeImpl &rhs) const
Definition: Type.cpp:1000
bool CheckModuleCommon(const lldb::ModuleWP &input_module_wp, lldb::ModuleSP &module_sp) const
Definition: Type.cpp:971
TypeImpl GetCanonicalType() const
Definition: Type.cpp:1124
void SetType(const lldb::TypeSP &type_sp)
Definition: Type.cpp:934
TypeImpl GetUnqualifiedType() const
Definition: Type.cpp:1112
TypeImpl GetPointeeType() const
Definition: Type.cpp:1064
CompilerType m_dynamic_type
Definition: Type.h:627
CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic)
Definition: Type.cpp:1148
CompilerType m_static_type
Definition: Type.h:626
bool CheckModule(lldb::ModuleSP &module_sp) const
Definition: Type.cpp:963
lldb::ModuleSP GetModule() const
Definition: Type.cpp:1025
TypeImpl GetDereferencedType() const
Definition: Type.cpp:1100
bool IsValid() const
Definition: Type.cpp:1009
TypeImpl GetPointerType() const
Definition: Type.cpp:1052
lldb::ModuleWP m_exe_module_wp
Definition: Type.h:625
TypeImpl GetReferenceType() const
Definition: Type.cpp:1076
TypeImpl GetTypedefedType() const
Definition: Type.cpp:1088
lldb::ModuleWP m_module_wp
Definition: Type.h:624
ConstString GetName() const
Definition: Type.cpp:1032
CompilerType FindDirectNestedType(llvm::StringRef name)
Definition: Type.cpp:1176
ConstString GetDisplayTypeName() const
Definition: Type.cpp:1042
void Append(const lldb::TypeImplSP &type)
Definition: Type.h:634
void ForEach(std::function< bool(const lldb::TypeSP &type_sp)> const &callback) const
Definition: TypeList.cpp:78
bool Empty() const
Definition: TypeMap.cpp:77
bool InsertUnique(const lldb::TypeSP &type)
Definition: TypeMap.cpp:34
CompilerType GetReturnType() const
Definition: Type.cpp:1236
ConstString GetMangledName() const
Definition: Type.cpp:1202
CompilerType GetType() const
Definition: Type.cpp:1206
ConstString GetName() const
Definition: Type.cpp:1200
CompilerType GetArgumentAtIndex(size_t idx) const
Definition: Type.cpp:1249
bool GetDescription(Stream &stream)
Definition: Type.cpp:1212
lldb::MemberFunctionKind GetKind() const
Definition: Type.cpp:1208
lldb::MemberFunctionKind m_kind
Definition: Type.h:789
A class that contains all state required for type lookups.
Definition: Type.h:96
std::vector< lldb_private::CompilerContext > m_context
A full or partial compiler context array where the parent declaration contexts appear at the top of t...
Definition: Type.h:290
void AddLanguage(lldb::LanguageType language)
Add a language family to the list of languages that should produce a match.
Definition: Type.cpp:142
TypeQueryOptions m_options
An options bitmask that contains enabled options for the type query.
Definition: Type.h:293
bool LanguageMatches(lldb::LanguageType language) const
Check if the language matches any languages that have been added to this match object.
Definition: Type.cpp:169
bool GetExactMatch() const
Definition: Type.h:262
void SetLanguages(LanguageSet languages)
Set the list of languages that should produce a match to only the ones specified in languages.
Definition: Type.cpp:148
std::optional< LanguageSet > m_languages
If this variable has a value, then the language family must match at least one of the specified langu...
Definition: Type.h:297
ConstString GetTypeBasename() const
Get the type basename to use when searching the type indexes in each SymbolFile object.
Definition: Type.cpp:136
bool ContextMatches(llvm::ArrayRef< lldb_private::CompilerContext > context) const
Check of a CompilerContext array from matching type from a symbol file matches the m_context.
Definition: Type.cpp:152
bool GetFindOne() const
Returns true if the type query is supposed to find only a single matching type.
Definition: Type.h:271
This class tracks the state and results of a TypeQuery.
Definition: Type.h:304
bool InsertUnique(const lldb::TypeSP &type_sp)
When types that match a TypeQuery are found, this API is used to insert the matching types.
Definition: Type.cpp:180
llvm::DenseSet< lldb_private::SymbolFile * > m_searched_symbol_files
This set is used to track and make sure we only perform lookups in a symbol file one time.
Definition: Type.h:354
bool Done(const TypeQuery &query) const
Check if the type matching has found all of the matches that it needs.
Definition: Type.cpp:186
lldb::TypeSP GetFirstType() const
Definition: Type.h:345
bool AlreadySearched(lldb_private::SymbolFile *sym_file)
Check if a SymbolFile object has already been searched by this type match object.
Definition: Type.cpp:176
TypeMap m_type_map
Matching types get added to this map as type search continues.
Definition: Type.h:351
Type * m_encoding_type
Definition: Type.h:514
CompilerType m_compiler_type
Definition: Type.h:520
CompilerType GetForwardCompilerType()
Definition: Type.cpp:751
lldb::Format GetFormat()
Definition: Type.cpp:513
Declaration m_decl
Definition: Type.h:519
Type * GetEncodingType()
Definition: Type.cpp:440
ConstString GetName()
Definition: Type.cpp:428
static bool GetTypeScopeAndBasename(llvm::StringRef name, llvm::StringRef &scope, llvm::StringRef &basename, lldb::TypeClass &type_class)
Definition: Type.cpp:760
const lldb_private::Declaration & GetDeclaration() const
Definition: Type.cpp:563
uint64_t m_byte_size_has_value
Definition: Type.h:518
bool IsTemplateType()
Definition: Type.cpp:499
ResolveState m_compiler_type_resolve_state
Definition: Type.h:521
ConstString m_name
Definition: Type.h:510
uint32_t GetEncodingMask()
Definition: Type.cpp:732
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name, ExecutionContextScope *exe_scope)
Definition: Type.cpp:297
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes)
Definition: Type.cpp:491
SymbolContextScope * m_context
The symbol context in which this type is defined.
Definition: Type.h:513
lldb::user_id_t m_encoding_uid
Definition: Type.h:515
@ eEncodingIsRestrictUID
This type is the type whose UID is m_encoding_uid with the restrict qualifier added.
Definition: Type.h:389
@ eEncodingIsConstUID
This type is the type whose UID is m_encoding_uid with the const qualifier added.
Definition: Type.h:386
@ eEncodingIsVolatileUID
This type is the type whose UID is m_encoding_uid with the volatile qualifier added.
Definition: Type.h:392
@ eEncodingIsAtomicUID
This type is the type whose UID is m_encoding_uid as an atomic type.
Definition: Type.h:402
@ eEncodingIsSyntheticUID
This type is the synthetic type whose UID is m_encoding_uid.
Definition: Type.h:404
@ eEncodingInvalid
Invalid encoding.
Definition: Type.h:381
@ eEncodingIsTypedefUID
This type is alias to a type whose UID is m_encoding_uid.
Definition: Type.h:394
@ eEncodingIsPointerUID
This type is pointer to a type whose UID is m_encoding_uid.
Definition: Type.h:396
@ eEncodingIsLValueReferenceUID
This type is L value reference to a type whose UID is m_encoding_uid.
Definition: Type.h:398
@ eEncodingIsRValueReferenceUID
This type is R value reference to a type whose UID is m_encoding_uid.
Definition: Type.h:400
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
Definition: Type.h:383
Payload m_payload
Language-specific flags.
Definition: Type.h:523
SymbolFile * GetSymbolFile()
Definition: Type.h:434
void Dump(Stream *s, bool show_context, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
Definition: Type.cpp:362
CompilerType GetLayoutCompilerType()
Definition: Type.cpp:746
lldb::Encoding GetEncoding(uint64_t &count)
Definition: Type.cpp:515
lldb::ModuleSP GetExeModule()
GetModule may return module for compile unit's object file.
Definition: Type.cpp:827
void DumpTypeName(Stream *s)
Definition: Type.cpp:438
lldb::TypeSP GetTypedefType()
Definition: Type.cpp:503
bool ResolveCompilerType(ResolveState compiler_type_resolve_state)
Definition: Type.cpp:565
SymbolFile * m_symbol_file
Definition: Type.h:511
bool IsAggregateType()
Definition: Type.cpp:495
EncodingDataType m_encoding_uid_type
Definition: Type.h:516
uint64_t m_byte_size
Definition: Type.h:517
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope)
Definition: Type.cpp:446
bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition: Type.cpp:520
ConstString GetBaseName()
Definition: Type.cpp:434
ConstString GetQualifiedName()
Definition: Type.cpp:756
CompilerType GetFullCompilerType()
Definition: Type.cpp:741
lldb::ModuleSP GetModule()
Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sur...
Definition: Type.cpp:821
bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition: Type.cpp:558
bool IsTypedef()
Definition: Type.h:452
#define LLDB_INVALID_UID
Definition: lldb-defines.h:88
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:314
@ AnyModule
Match 0..n nested modules.
@ AnyDeclContext
Math any declaration context.
bool contextMatches(llvm::ArrayRef< CompilerContext > context_chain, llvm::ArrayRef< CompilerContext > pattern)
Match context_chain against pattern, which may contain "Any" kinds.
Definition: Type.cpp:38
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
@ eAddressTypeHost
Address is an address in the process that is running this code.
Definition: SBAddress.h:15
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::weak_ptr< lldb_private::Module > ModuleWP
Definition: lldb-forward.h:366
Format
Display format definitions.
LanguageType
Programming language type.
@ eLanguageTypeC
Non-standardized C, such as K&R.
std::shared_ptr< lldb_private::Type > TypeSP
Definition: lldb-forward.h:449
Encoding
Register encoding definitions.
MemberFunctionKind
Kind of member function.
@ eMemberFunctionKindInstanceMethod
A function that applies to a specific instance.
@ eMemberFunctionKindConstructor
A function used to create instances.
@ eMemberFunctionKindUnknown
Not sure what the type of this is.
@ eMemberFunctionKindDestructor
A function used to tear down existing instances.
@ eMemberFunctionKindStaticMethod
A function that applies to a type rather than any instance.
uint64_t user_id_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:328
uint64_t addr_t
Definition: lldb-types.h:79
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
Definition: lldb-forward.h:452
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:365
CompilerContext allows an array of these items to be passed to perform detailed lookups in SymbolVend...
Definition: Type.h:50
void Dump(Stream &s) const
Definition: Type.cpp:192
CompilerContextKind kind
Definition: Type.h:60
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: Type.h:36
A mix in class that contains a generic user ID.
Definition: UserID.h:31
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47