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 <algorithm>
10#include <cstdio>
11#include <iterator>
12#include <optional>
13
14#include "lldb/Core/Module.h"
18#include "lldb/Utility/Log.h"
19#include "lldb/Utility/Scalar.h"
21
27#include "lldb/Symbol/Type.h"
30
32#include "lldb/Target/Process.h"
33#include "lldb/Target/Target.h"
36
37#include "llvm/ADT/StringRef.h"
38
39using namespace lldb;
40using namespace lldb_private;
41
42llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &os,
43 const CompilerContext &rhs) {
44 StreamString lldb_stream;
45 rhs.Dump(lldb_stream);
46 return os << lldb_stream.GetString();
47}
48
49static CompilerContextKind ConvertTypeClass(lldb::TypeClass type_class) {
50 if (type_class == eTypeClassAny)
51 return CompilerContextKind::AnyType;
52 CompilerContextKind result = {};
53 if (type_class & (lldb::eTypeClassClass | lldb::eTypeClassStruct))
54 result |= CompilerContextKind::ClassOrStruct;
55 if (type_class & lldb::eTypeClassUnion)
56 result |= CompilerContextKind::Union;
57 if (type_class & lldb::eTypeClassEnumeration)
58 result |= CompilerContextKind::Enum;
59 if (type_class & lldb::eTypeClassFunction)
60 result |= CompilerContextKind::Function;
61 if (type_class & lldb::eTypeClassTypedef)
62 result |= CompilerContextKind::Typedef;
63 return result;
64}
65
66TypeQuery::TypeQuery(llvm::StringRef name, TypeQueryOptions options)
67 : m_options(options) {
68 if (std::optional<Type::ParsedName> parsed_name =
70 llvm::ArrayRef scope = parsed_name->scope;
71 if (!scope.empty()) {
72 if (scope[0] == "::") {
73 m_options |= e_exact_match;
74 scope = scope.drop_front();
75 }
76 for (llvm::StringRef s : scope) {
77 m_context.push_back(
79 }
80 }
81 m_context.push_back({ConvertTypeClass(parsed_name->type_class),
82 ConstString(parsed_name->basename)});
83 } else {
85 }
86}
87
89 ConstString type_basename, TypeQueryOptions options)
90 : m_options(options) {
91 // Always use an exact match if we are looking for a type in compiler context.
92 m_options |= e_exact_match;
93 m_context = decl_ctx.GetCompilerContext();
94 m_context.push_back({CompilerContextKind::AnyType, type_basename});
95}
96
98 const llvm::ArrayRef<lldb_private::CompilerContext> &context,
99 TypeQueryOptions options)
100 : m_context(context), m_options(options) {
101 // Always use an exact match if we are looking for a type in compiler context.
102 m_options |= e_exact_match;
103}
104
105TypeQuery::TypeQuery(const CompilerDecl &decl, TypeQueryOptions options)
106 : m_options(options) {
107 // Always for an exact match if we are looking for a type using a declaration.
108 m_options |= e_exact_match;
110}
111
113 if (m_context.empty())
114 return ConstString();
115 return m_context.back().name;
116}
117
119 if (!m_languages)
121 m_languages->Insert(language);
122}
123
125 m_languages = std::move(languages);
126}
127
129 llvm::ArrayRef<CompilerContext> context_chain) const {
130 auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
131 for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
132 pat != pat_end;) {
133
134 if (ctx == ctx_end)
135 return false; // Pattern too long.
136
137 if (ctx->kind == CompilerContextKind::Namespace && ctx->name.IsEmpty()) {
138 // We're matching an anonymous namespace. These are optional, so we check
139 // if the pattern expects an anonymous namespace.
140 if (pat->name.IsEmpty() && (pat->kind & CompilerContextKind::Namespace) ==
142 // Match, advance both iterators.
143 ++pat;
144 }
145 // Otherwise, only advance the context to skip over the anonymous
146 // namespace, and try matching again.
147 ++ctx;
148 continue;
149 }
150
151 // See if there is a kind mismatch; they should have 1 bit in common.
152 if ((ctx->kind & pat->kind) == CompilerContextKind())
153 return false;
154
155 if (ctx->name != pat->name)
156 return false;
157
158 ++ctx;
159 ++pat;
160 }
161
162 // Skip over any remaining module and anonymous namespace entries if we were
163 // asked to do that.
164 auto should_skip = [this](const CompilerContext &ctx) {
165 if (ctx.kind == CompilerContextKind::Module)
166 return GetIgnoreModules();
167 if (ctx.kind == CompilerContextKind::Namespace && ctx.name.IsEmpty())
168 return !GetStrictNamespaces();
169 return false;
170 };
171 ctx = std::find_if_not(ctx, ctx_end, should_skip);
172
173 // At this point, we have exhausted the pattern and we have a partial match at
174 // least. If that's all we're looking for, we're done.
175 if (!GetExactMatch())
176 return true;
177
178 // We have an exact match if we've exhausted the target context as well.
179 return ctx == ctx_end;
180}
181
183 // If we have no language filterm language always matches.
184 if (!m_languages.has_value())
185 return true;
186 return (*m_languages)[language];
187}
188
190 return !m_searched_symbol_files.insert(sym_file).second;
191}
192
194 if (type_sp)
195 return m_type_map.InsertUnique(type_sp);
196 return false;
197}
198
199bool TypeResults::Done(const TypeQuery &query) const {
200 if (query.GetFindOne())
201 return !m_type_map.Empty();
202 return false;
203}
204
206 switch (kind) {
207 default:
208 s << "Invalid";
209 break;
211 s << "TranslationUnit";
212 break;
214 s << "Module";
215 break;
217 s << "Namespace";
218 break;
220 s << "ClassOrStruct";
221 break;
223 s << "Union";
224 break;
226 s << "Function";
227 break;
229 s << "Variable";
230 break;
232 s << "Enumeration";
233 break;
235 s << "Typedef";
236 break;
238 s << "AnyType";
239 break;
240 }
241 s << "(" << name << ")";
242}
243
245public:
246 TypeAppendVisitor(TypeListImpl &type_list) : m_type_list(type_list) {}
247
248 bool operator()(const lldb::TypeSP &type) {
249 m_type_list.Append(TypeImplSP(new TypeImpl(type)));
250 return true;
251 }
252
253private:
255};
256
258 TypeAppendVisitor cb(*this);
259 type_list.ForEach(cb);
260}
261
263 const lldb::TypeSP &type_sp)
264 : UserID(type_sp ? type_sp->GetID() : LLDB_INVALID_UID),
265 m_symbol_file(symbol_file), m_type_sp(type_sp) {}
266
268 if (!m_type_sp) {
269 Type *resolved_type = m_symbol_file.ResolveTypeUID(GetID());
270 if (resolved_type)
271 m_type_sp = resolved_type->shared_from_this();
272 }
273 return m_type_sp.get();
274}
275
277 std::optional<uint64_t> byte_size, SymbolContextScope *context,
278 user_id_t encoding_uid, EncodingDataType encoding_uid_type,
279 const Declaration &decl, const CompilerType &compiler_type,
280 ResolveState compiler_type_resolve_state, uint32_t opaque_payload)
281 : std::enable_shared_from_this<Type>(), UserID(uid), m_name(name),
282 m_symbol_file(symbol_file), m_context(context),
283 m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type),
284 m_decl(decl), m_compiler_type(compiler_type),
285 m_compiler_type_resolve_state(compiler_type ? compiler_type_resolve_state
286 : ResolveState::Unresolved),
287 m_payload(opaque_payload) {
288 if (byte_size) {
289 m_byte_size = *byte_size;
291 } else {
292 m_byte_size = 0;
293 m_byte_size_has_value = false;
294 }
295}
296
298 : std::enable_shared_from_this<Type>(), UserID(0), m_name("<INVALID TYPE>"),
299 m_payload(0) {
300 m_byte_size = 0;
301 m_byte_size_has_value = false;
302}
303
305 bool show_name, ExecutionContextScope *exe_scope) {
306 *s << "id = " << (const UserID &)*this;
307
308 // Call the name accessor to make sure we resolve the type name
309 if (show_name) {
310 ConstString type_name = GetName();
311 if (type_name) {
312 *s << ", name = \"" << type_name << '"';
313 ConstString qualified_type_name(GetQualifiedName());
314 if (qualified_type_name != type_name) {
315 *s << ", qualified = \"" << qualified_type_name << '"';
316 }
317 }
318 }
319
320 // Call the get byte size accessor so we resolve our byte size
321 if (GetByteSize(exe_scope))
322 s->Printf(", byte-size = %" PRIu64, m_byte_size);
323 bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
324 m_decl.Dump(s, show_fullpaths);
325
326 if (m_compiler_type.IsValid()) {
327 *s << ", compiler_type = \"";
329 *s << '"';
330 } else if (m_encoding_uid != LLDB_INVALID_UID) {
331 s->Printf(", type_uid = 0x%8.8" PRIx64, m_encoding_uid);
332 switch (m_encoding_uid_type) {
333 case eEncodingInvalid:
334 break;
335 case eEncodingIsUID:
336 s->PutCString(" (unresolved type)");
337 break;
339 s->PutCString(" (unresolved const type)");
340 break;
342 s->PutCString(" (unresolved restrict type)");
343 break;
345 s->PutCString(" (unresolved volatile type)");
346 break;
348 s->PutCString(" (unresolved atomic type)");
349 break;
351 s->PutCString(" (unresolved typedef)");
352 break;
354 s->PutCString(" (unresolved pointer)");
355 break;
357 s->PutCString(" (unresolved L value reference)");
358 break;
360 s->PutCString(" (unresolved R value reference)");
361 break;
363 s->PutCString(" (synthetic type)");
364 break;
366 s->PutCString(" (ptrauth type)");
367 break;
368 }
369 }
370}
371
372void Type::Dump(Stream *s, bool show_context, lldb::DescriptionLevel level) {
373 s->Printf("%p: ", static_cast<void *>(this));
374 s->Indent();
375 *s << "Type" << static_cast<const UserID &>(*this) << ' ';
376 if (m_name)
377 *s << ", name = \"" << m_name << "\"";
378
380 s->Printf(", size = %" PRIu64, m_byte_size);
381
382 if (show_context && m_context != nullptr) {
383 s->PutCString(", context = ( ");
385 s->PutCString(" )");
386 }
387
388 bool show_fullpaths = false;
389 m_decl.Dump(s, show_fullpaths);
390
391 if (m_compiler_type.IsValid()) {
392 *s << ", compiler_type = " << m_compiler_type.GetOpaqueQualType() << ' ';
394 } else if (m_encoding_uid != LLDB_INVALID_UID) {
395 s->Format(", type_data = {0:x-16}", m_encoding_uid);
396 switch (m_encoding_uid_type) {
397 case eEncodingInvalid:
398 break;
399 case eEncodingIsUID:
400 s->PutCString(" (unresolved type)");
401 break;
403 s->PutCString(" (unresolved const type)");
404 break;
406 s->PutCString(" (unresolved restrict type)");
407 break;
409 s->PutCString(" (unresolved volatile type)");
410 break;
412 s->PutCString(" (unresolved atomic type)");
413 break;
415 s->PutCString(" (unresolved typedef)");
416 break;
418 s->PutCString(" (unresolved pointer)");
419 break;
421 s->PutCString(" (unresolved L value reference)");
422 break;
424 s->PutCString(" (unresolved R value reference)");
425 break;
427 s->PutCString(" (synthetic type)");
428 break;
430 s->PutCString(" (ptrauth type)");
431 }
432 }
433
434 //
435 // if (m_access)
436 // s->Printf(", access = %u", m_access);
437 s->EOL();
438}
439
441 if (!m_name)
443 return m_name;
444}
445
447 return GetForwardCompilerType().GetTypeName(/*BaseOnly*/ true);
448}
449
450void Type::DumpTypeName(Stream *s) { GetName().Dump(s, "<invalid-type-name>"); }
451
455 return m_encoding_type;
456}
457
458std::optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
460 return static_cast<uint64_t>(m_byte_size);
461
462 switch (m_encoding_uid_type) {
463 case eEncodingInvalid:
465 break;
466 case eEncodingIsUID:
472 Type *encoding_type = GetEncodingType();
473 if (encoding_type)
474 if (std::optional<uint64_t> size =
475 encoding_type->GetByteSize(exe_scope)) {
476 m_byte_size = *size;
478 return static_cast<uint64_t>(m_byte_size);
479 }
480
481 if (std::optional<uint64_t> size =
482 GetLayoutCompilerType().GetByteSize(exe_scope)) {
483 m_byte_size = *size;
485 return static_cast<uint64_t>(m_byte_size);
486 }
487 } break;
488
489 // If we are a pointer or reference, then this is just a pointer size;
495 m_byte_size = arch.GetAddressByteSize();
497 return static_cast<uint64_t>(m_byte_size);
498 }
499 } break;
500 }
501 return {};
502}
503
504llvm::Expected<uint32_t> Type::GetNumChildren(bool omit_empty_base_classes) {
505 return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr);
506}
507
510}
511
514}
515
517 lldb::TypeSP type_sp;
518 if (IsTypedef()) {
520 if (typedef_type)
521 type_sp = typedef_type->shared_from_this();
522 }
523 return type_sp;
524}
525
527
529 // Make sure we resolve our type if it already hasn't been.
530 return GetForwardCompilerType().GetEncoding(count);
531}
532
534 AddressType address_type, DataExtractor &data) {
535 if (address_type == eAddressTypeFile) {
536 // Can't convert a file address to anything valid without more context
537 // (which Module it came from)
538 return false;
539 }
540
541 const uint64_t byte_size =
542 GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
543 .value_or(0);
544 if (data.GetByteSize() < byte_size) {
545 lldb::DataBufferSP data_sp(new DataBufferHeap(byte_size, '\0'));
546 data.SetData(data_sp);
547 }
548
549 uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
550 if (dst != nullptr) {
551 if (address_type == eAddressTypeHost) {
552 // The address is an address in this process, so just copy it
553 if (addr == 0)
554 return false;
555 memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
556 return true;
557 } else {
558 if (exe_ctx) {
559 Process *process = exe_ctx->GetProcessPtr();
560 if (process) {
562 return exe_ctx->GetProcessPtr()->ReadMemory(addr, dst, byte_size,
563 error) == byte_size;
564 }
565 }
566 }
567 }
568 return false;
569}
570
572 AddressType address_type, DataExtractor &data) {
573 return false;
574}
575
576const Declaration &Type::GetDeclaration() const { return m_decl; }
577
578bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) {
579 // TODO: This needs to consider the correct type system to use.
580 Type *encoding_type = nullptr;
581 if (!m_compiler_type.IsValid()) {
582 encoding_type = GetEncodingType();
583 if (encoding_type) {
584 switch (m_encoding_uid_type) {
585 case eEncodingIsUID: {
586 CompilerType encoding_compiler_type =
587 encoding_type->GetForwardCompilerType();
588 if (encoding_compiler_type.IsValid()) {
589 m_compiler_type = encoding_compiler_type;
591 encoding_type->m_compiler_type_resolve_state;
592 }
593 } break;
594
597 encoding_type->GetForwardCompilerType().AddConstModifier();
598 break;
599
603 break;
604
608 break;
609
612 encoding_type->GetForwardCompilerType().GetAtomicType();
613 break;
614
617 m_name.AsCString("__lldb_invalid_typedef_name"),
618 GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
619 m_name.Clear();
620 break;
621
624 encoding_type->GetForwardCompilerType().GetPointerType();
625 break;
626
630 break;
631
635 break;
636
640 m_payload);
641 break;
642
643 default:
644 llvm_unreachable("Unhandled encoding_data_type.");
645 }
646 } else {
647 // We have no encoding type, return void?
648 auto type_system_or_err =
650 if (auto err = type_system_or_err.takeError()) {
652 GetLog(LLDBLog::Symbols), std::move(err),
653 "Unable to construct void type from TypeSystemClang: {0}");
654 } else {
655 CompilerType void_compiler_type;
656 auto ts = *type_system_or_err;
657 if (ts)
658 void_compiler_type = ts->GetBasicTypeFromAST(eBasicTypeVoid);
659 switch (m_encoding_uid_type) {
660 case eEncodingIsUID:
661 m_compiler_type = void_compiler_type;
662 break;
663
665 m_compiler_type = void_compiler_type.AddConstModifier();
666 break;
667
669 m_compiler_type = void_compiler_type.AddRestrictModifier();
670 break;
671
673 m_compiler_type = void_compiler_type.AddVolatileModifier();
674 break;
675
677 m_compiler_type = void_compiler_type.GetAtomicType();
678 break;
679
681 m_compiler_type = void_compiler_type.CreateTypedef(
682 m_name.AsCString("__lldb_invalid_typedef_name"),
683 GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
684 break;
685
687 m_compiler_type = void_compiler_type.GetPointerType();
688 break;
689
691 m_compiler_type = void_compiler_type.GetLValueReferenceType();
692 break;
693
695 m_compiler_type = void_compiler_type.GetRValueReferenceType();
696 break;
697
699 llvm_unreachable("Cannot handle eEncodingIsLLVMPtrAuthUID without "
700 "valid encoding_type");
701
702 default:
703 llvm_unreachable("Unhandled encoding_data_type.");
704 }
705 }
706 }
707
708 // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is
709 // set to eResolveStateUnresolved so we need to update it to say that we
710 // now have a forward declaration since that is what we created above.
713 }
714
715 // Check if we have a forward reference to a class/struct/union/enum?
716 if (compiler_type_resolve_state == ResolveState::Layout ||
717 compiler_type_resolve_state == ResolveState::Full) {
718 // Check if we have a forward reference to a class/struct/union/enum?
719 if (m_compiler_type.IsValid() &&
720 m_compiler_type_resolve_state < compiler_type_resolve_state) {
722 if (!m_compiler_type.IsDefined()) {
723 // We have a forward declaration, we need to resolve it to a complete
724 // definition.
726 }
727 }
728 }
729
730 // If we have an encoding type, then we need to make sure it is resolved
731 // appropriately.
733 if (encoding_type == nullptr)
734 encoding_type = GetEncodingType();
735 if (encoding_type) {
736 ResolveState encoding_compiler_type_resolve_state =
737 compiler_type_resolve_state;
738
739 if (compiler_type_resolve_state == ResolveState::Layout) {
740 switch (m_encoding_uid_type) {
744 encoding_compiler_type_resolve_state = ResolveState::Forward;
745 break;
746 default:
747 break;
748 }
749 }
750 encoding_type->ResolveCompilerType(encoding_compiler_type_resolve_state);
751 }
752 }
753 return m_compiler_type.IsValid();
754}
756 uint32_t encoding_mask = 1u << m_encoding_uid_type;
757 Type *encoding_type = GetEncodingType();
758 assert(encoding_type != this);
759 if (encoding_type)
760 encoding_mask |= encoding_type->GetEncodingMask();
761 return encoding_mask;
762}
763
766 return m_compiler_type;
767}
768
771 return m_compiler_type;
772}
773
776 return m_compiler_type;
777}
778
781}
782
783std::optional<Type::ParsedName>
784Type::GetTypeScopeAndBasename(llvm::StringRef name) {
785 ParsedName result;
786
787 if (name.empty())
788 return std::nullopt;
789
790 if (name.consume_front("struct "))
791 result.type_class = eTypeClassStruct;
792 else if (name.consume_front("class "))
793 result.type_class = eTypeClassClass;
794 else if (name.consume_front("union "))
795 result.type_class = eTypeClassUnion;
796 else if (name.consume_front("enum "))
797 result.type_class = eTypeClassEnumeration;
798 else if (name.consume_front("typedef "))
799 result.type_class = eTypeClassTypedef;
800
801 if (name.consume_front("::"))
802 result.scope.push_back("::");
803
804 bool prev_is_colon = false;
805 size_t template_depth = 0;
806 size_t name_begin = 0;
807 for (const auto &pos : llvm::enumerate(name)) {
808 switch (pos.value()) {
809 case ':':
810 if (prev_is_colon && template_depth == 0) {
811 llvm::StringRef scope_name = name.slice(name_begin, pos.index() - 1);
812 // The itanium demangler uses this string to represent anonymous
813 // namespaces. Convert it to a more language-agnostic form (which is
814 // also used in DWARF).
815 if (scope_name == "(anonymous namespace)")
816 scope_name = "";
817 result.scope.push_back(scope_name);
818 name_begin = pos.index() + 1;
819 }
820 break;
821 case '<':
822 ++template_depth;
823 break;
824 case '>':
825 if (template_depth == 0)
826 return std::nullopt; // Invalid name.
827 --template_depth;
828 break;
829 }
830 prev_is_colon = pos.value() == ':';
831 }
832
833 if (name_begin < name.size() && template_depth == 0)
834 result.basename = name.substr(name_begin);
835 else
836 return std::nullopt;
837
838 return result;
839}
840
842 if (m_symbol_file)
844 return ModuleSP();
845}
846
848 if (m_compiler_type) {
849 auto ts = m_compiler_type.GetTypeSystem();
850 if (!ts)
851 return {};
852 SymbolFile *symbol_file = ts->GetSymbolFile();
853 if (symbol_file)
854 return symbol_file->GetObjectFile()->GetModule();
855 }
856 return {};
857}
858
860 if (in_type_sp) {
861 m_compiler_type = in_type_sp->GetForwardCompilerType();
862 m_type_name = in_type_sp->GetName();
863 }
864}
865
866TypeAndOrName::TypeAndOrName(const char *in_type_str)
867 : m_type_name(in_type_str) {}
868
870 : m_type_name(in_type_const_string) {}
871
872bool TypeAndOrName::operator==(const TypeAndOrName &other) const {
873 if (m_compiler_type != other.m_compiler_type)
874 return false;
875 if (m_type_name != other.m_type_name)
876 return false;
877 return true;
878}
879
880bool TypeAndOrName::operator!=(const TypeAndOrName &other) const {
881 return !(*this == other);
882}
883
885 if (m_type_name)
886 return m_type_name;
887 if (m_compiler_type)
889 return ConstString("<invalid>");
890}
891
893 m_type_name = type_name;
894}
895
896void TypeAndOrName::SetName(const char *type_name_cstr) {
897 m_type_name.SetCString(type_name_cstr);
898}
899
900void TypeAndOrName::SetName(llvm::StringRef type_name) {
901 m_type_name.SetString(type_name);
902}
903
905 if (type_sp) {
906 m_compiler_type = type_sp->GetForwardCompilerType();
907 m_type_name = type_sp->GetName();
908 } else
909 Clear();
910}
911
913 m_compiler_type = compiler_type;
914 if (m_compiler_type)
916}
917
919 return !((bool)m_type_name || (bool)m_compiler_type);
920}
921
925}
926
927bool TypeAndOrName::HasName() const { return (bool)m_type_name; }
928
930 return m_compiler_type.IsValid();
931}
932
934 : m_module_wp(), m_static_type(), m_dynamic_type() {
935 SetType(type_sp);
936}
937
938TypeImpl::TypeImpl(const CompilerType &compiler_type)
939 : m_module_wp(), m_static_type(), m_dynamic_type() {
940 SetType(compiler_type);
941}
942
943TypeImpl::TypeImpl(const lldb::TypeSP &type_sp, const CompilerType &dynamic)
944 : m_module_wp(), m_static_type(), m_dynamic_type(dynamic) {
945 SetType(type_sp, dynamic);
946}
947
949 const CompilerType &dynamic_type)
950 : m_module_wp(), m_static_type(), m_dynamic_type() {
951 SetType(static_type, dynamic_type);
952}
953
954void TypeImpl::SetType(const lldb::TypeSP &type_sp) {
955 if (type_sp) {
956 m_static_type = type_sp->GetForwardCompilerType();
957 m_exe_module_wp = type_sp->GetExeModule();
958 m_module_wp = type_sp->GetModule();
959 } else {
962 }
963}
964
965void TypeImpl::SetType(const CompilerType &compiler_type) {
967 m_static_type = compiler_type;
968}
969
970void TypeImpl::SetType(const lldb::TypeSP &type_sp,
971 const CompilerType &dynamic) {
972 SetType(type_sp);
973 m_dynamic_type = dynamic;
974}
975
976void TypeImpl::SetType(const CompilerType &compiler_type,
977 const CompilerType &dynamic) {
979 m_static_type = compiler_type;
980 m_dynamic_type = dynamic;
981}
982
983bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const {
984 return CheckModuleCommon(m_module_wp, module_sp);
985}
986
988 return CheckModuleCommon(m_exe_module_wp, module_sp);
989}
990
991bool TypeImpl::CheckModuleCommon(const lldb::ModuleWP &input_module_wp,
992 lldb::ModuleSP &module_sp) const {
993 // Check if we have a module for this type. If we do and the shared pointer
994 // is can be successfully initialized with m_module_wp, return true. Else
995 // return false if we didn't have a module, or if we had a module and it has
996 // been deleted. Any functions doing anything with a TypeSP in this TypeImpl
997 // class should call this function and only do anything with the ivars if
998 // this function returns true. If we have a module, the "module_sp" will be
999 // filled in with a strong reference to the module so that the module will at
1000 // least stay around long enough for the type query to succeed.
1001 module_sp = input_module_wp.lock();
1002 if (!module_sp) {
1003 lldb::ModuleWP empty_module_wp;
1004 // If either call to "std::weak_ptr::owner_before(...) value returns true,
1005 // this indicates that m_module_wp once contained (possibly still does) a
1006 // reference to a valid shared pointer. This helps us know if we had a
1007 // valid reference to a section which is now invalid because the module it
1008 // was in was deleted
1009 if (empty_module_wp.owner_before(input_module_wp) ||
1010 input_module_wp.owner_before(empty_module_wp)) {
1011 // input_module_wp had a valid reference to a module, but all strong
1012 // references have been released and the module has been deleted
1013 return false;
1014 }
1015 }
1016 // We either successfully locked the module, or didn't have one to begin with
1017 return true;
1018}
1019
1020bool TypeImpl::operator==(const TypeImpl &rhs) const {
1021 return m_static_type == rhs.m_static_type &&
1023}
1024
1025bool TypeImpl::operator!=(const TypeImpl &rhs) const {
1026 return !(*this == rhs);
1027}
1028
1029bool TypeImpl::IsValid() const {
1030 // just a name is not valid
1031 ModuleSP module_sp;
1032 if (CheckModule(module_sp))
1034 return false;
1035}
1036
1037TypeImpl::operator bool() const { return IsValid(); }
1038
1043}
1044
1046 lldb::ModuleSP module_sp;
1047 if (CheckExeModule(module_sp))
1048 return module_sp;
1049 return nullptr;
1050}
1051
1053 ModuleSP module_sp;
1054 if (CheckModule(module_sp)) {
1055 if (m_dynamic_type)
1056 return m_dynamic_type.GetTypeName();
1057 return m_static_type.GetTypeName();
1058 }
1059 return ConstString();
1060}
1061
1063 ModuleSP module_sp;
1064 if (CheckModule(module_sp)) {
1065 if (m_dynamic_type)
1068 }
1069 return ConstString();
1070}
1071
1073 ModuleSP module_sp;
1074 if (CheckModule(module_sp)) {
1075 if (m_dynamic_type.IsValid()) {
1078 }
1080 }
1081 return TypeImpl();
1082}
1083
1085 ModuleSP module_sp;
1086 if (CheckModule(module_sp)) {
1087 if (m_dynamic_type.IsValid()) {
1090 }
1092 }
1093 return TypeImpl();
1094}
1095
1097 ModuleSP module_sp;
1098 if (CheckModule(module_sp)) {
1099 if (m_dynamic_type.IsValid()) {
1102 }
1104 }
1105 return TypeImpl();
1106}
1107
1109 ModuleSP module_sp;
1110 if (CheckModule(module_sp)) {
1111 if (m_dynamic_type.IsValid()) {
1114 }
1116 }
1117 return TypeImpl();
1118}
1119
1121 ModuleSP module_sp;
1122 if (CheckModule(module_sp)) {
1123 if (m_dynamic_type.IsValid()) {
1126 }
1128 }
1129 return TypeImpl();
1130}
1131
1133 ModuleSP module_sp;
1134 if (CheckModule(module_sp)) {
1135 if (m_dynamic_type.IsValid()) {
1138 }
1140 }
1141 return TypeImpl();
1142}
1143
1145 ModuleSP module_sp;
1146 if (CheckModule(module_sp)) {
1147 if (m_dynamic_type.IsValid()) {
1150 }
1152 }
1153 return TypeImpl();
1154}
1155
1157 ModuleSP module_sp;
1158 if (CheckModule(module_sp)) {
1159 if (prefer_dynamic) {
1160 if (m_dynamic_type.IsValid())
1161 return m_dynamic_type;
1162 }
1163 return m_static_type;
1164 }
1165 return CompilerType();
1166}
1167
1169 ModuleSP module_sp;
1170 if (CheckModule(module_sp)) {
1171 if (prefer_dynamic) {
1172 if (m_dynamic_type.IsValid())
1174 }
1176 }
1177 return {};
1178}
1179
1181 lldb::DescriptionLevel description_level) {
1182 ModuleSP module_sp;
1183 if (CheckModule(module_sp)) {
1184 if (m_dynamic_type.IsValid()) {
1185 strm.Printf("Dynamic:\n");
1187 strm.Printf("\nStatic:\n");
1188 }
1190 } else {
1191 strm.PutCString("Invalid TypeImpl module for type has been deleted\n");
1192 }
1193 return true;
1194}
1195
1197 if (name.empty())
1198 return CompilerType();
1199 return GetCompilerType(/*prefer_dynamic=*/false)
1201}
1202
1205}
1206
1208
1210 return m_decl.GetMangledName();
1211}
1212
1214
1216 return m_kind;
1217}
1218
1220 switch (m_kind) {
1222 return false;
1224 stream.Printf("constructor for %s",
1225 m_type.GetTypeName().AsCString("<unknown>"));
1226 break;
1228 stream.Printf("destructor for %s",
1229 m_type.GetTypeName().AsCString("<unknown>"));
1230 break;
1232 stream.Printf("instance method %s of type %s", m_name.AsCString(),
1234 break;
1236 stream.Printf("static method %s of type %s", m_name.AsCString(),
1238 break;
1239 }
1240 return true;
1241}
1242
1244 if (m_type)
1247}
1248
1250 if (m_type)
1252 else
1254}
1255
1257 if (m_type)
1259 else
1260 return m_decl.GetFunctionArgumentType(idx);
1261}
1262
1264 ConstString name,
1265 const llvm::APSInt &value)
1266 : m_integer_type_sp(integer_type_sp), m_name(name), m_value(value),
1267 m_valid((bool)name && (bool)integer_type_sp)
1268
1269{}
static llvm::raw_ostream & error(Stream &strm)
#define LLDB_LOG_ERROR(log, error,...)
Definition: Log.h:392
static CompilerContextKind ConvertTypeClass(lldb::TypeClass type_class)
Definition: Type.cpp:49
bool operator()(const lldb::TypeSP &type)
Definition: Type.cpp:248
TypeListImpl & m_type_list
Definition: Type.cpp:254
TypeAppendVisitor(TypeListImpl &type_list)
Definition: Type.cpp:246
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:289
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 GetDirectNestedTypeWithName(llvm::StringRef name) const
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.
CompilerType AddPtrAuthModifier(uint32_t payload) const
Return a new CompilerType adds a ptrauth modifier from the given 32-bit opaque payload to this type i...
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:232
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:343
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:1953
An error handling class.
Definition: Status.h:118
llvm::StringRef GetString() const
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:413
SymbolFileType(SymbolFile &symbol_file, lldb::user_id_t uid)
Definition: Type.h:400
lldb::TypeSP m_type_sp
Definition: Type.h:414
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:779
void SetName(ConstString type_name)
Definition: Type.cpp:892
bool operator!=(const TypeAndOrName &other) const
Definition: Type.cpp:880
bool operator==(const TypeAndOrName &other) const
Definition: Type.cpp:872
bool HasName() const
Definition: Type.cpp:927
ConstString GetName() const
Definition: Type.cpp:884
bool HasCompilerType() const
Definition: Type.cpp:929
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:912
ConstString m_type_name
Definition: Type.h:819
void SetTypeSP(lldb::TypeSP type_sp)
Definition: Type.cpp:904
CompilerType m_compiler_type
Definition: Type.h:818
bool IsEmpty() const
Definition: Type.cpp:918
CompilerType GetCompilerType(bool prefer_dynamic)
Definition: Type.cpp:1156
bool operator!=(const TypeImpl &rhs) const
Definition: Type.cpp:1025
bool CheckExeModule(lldb::ModuleSP &module_sp) const
Definition: Type.cpp:987
bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level)
Definition: Type.cpp:1180
bool operator==(const TypeImpl &rhs) const
Definition: Type.cpp:1020
bool CheckModuleCommon(const lldb::ModuleWP &input_module_wp, lldb::ModuleSP &module_sp) const
Definition: Type.cpp:991
TypeImpl GetCanonicalType() const
Definition: Type.cpp:1144
void SetType(const lldb::TypeSP &type_sp)
Definition: Type.cpp:954
TypeImpl GetUnqualifiedType() const
Definition: Type.cpp:1132
TypeImpl GetPointeeType() const
Definition: Type.cpp:1084
CompilerType m_dynamic_type
Definition: Type.h:694
CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic)
Definition: Type.cpp:1168
CompilerType m_static_type
Definition: Type.h:693
bool CheckModule(lldb::ModuleSP &module_sp) const
Definition: Type.cpp:983
lldb::ModuleSP GetModule() const
Definition: Type.cpp:1045
TypeImpl GetDereferencedType() const
Definition: Type.cpp:1120
bool IsValid() const
Definition: Type.cpp:1029
TypeImpl GetPointerType() const
Definition: Type.cpp:1072
lldb::ModuleWP m_exe_module_wp
Definition: Type.h:692
TypeImpl GetReferenceType() const
Definition: Type.cpp:1096
TypeImpl GetTypedefedType() const
Definition: Type.cpp:1108
lldb::ModuleWP m_module_wp
Definition: Type.h:691
ConstString GetName() const
Definition: Type.cpp:1052
CompilerType FindDirectNestedType(llvm::StringRef name)
Definition: Type.cpp:1196
ConstString GetDisplayTypeName() const
Definition: Type.cpp:1062
void Append(const lldb::TypeImplSP &type)
Definition: Type.h:701
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:1243
ConstString GetMangledName() const
Definition: Type.cpp:1209
CompilerType GetType() const
Definition: Type.cpp:1213
ConstString GetName() const
Definition: Type.cpp:1207
CompilerType GetArgumentAtIndex(size_t idx) const
Definition: Type.cpp:1256
bool GetDescription(Stream &stream)
Definition: Type.cpp:1219
lldb::MemberFunctionKind GetKind() const
Definition: Type.cpp:1215
lldb::MemberFunctionKind m_kind
Definition: Type.h:856
A class that contains all state required for type lookups.
Definition: Type.h:104
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:330
void AddLanguage(lldb::LanguageType language)
Add a language family to the list of languages that should produce a match.
Definition: Type.cpp:118
bool GetStrictNamespaces() const
Definition: Type.h:280
TypeQueryOptions m_options
An options bitmask that contains enabled options for the type query.
Definition: Type.h:333
bool LanguageMatches(lldb::LanguageType language) const
Check if the language matches any languages that have been added to this match object.
Definition: Type.cpp:182
bool GetExactMatch() const
Definition: Type.h:270
bool GetIgnoreModules() const
Definition: Type.h:272
void SetLanguages(LanguageSet languages)
Set the list of languages that should produce a match to only the ones specified in languages.
Definition: Type.cpp:124
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:337
ConstString GetTypeBasename() const
Get the type basename to use when searching the type indexes in each SymbolFile object.
Definition: Type.cpp:112
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:128
bool GetFindOne() const
Returns true if the type query is supposed to find only a single matching type.
Definition: Type.h:298
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:193
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:394
bool Done(const TypeQuery &query) const
Check if the type matching has found all of the matches that it needs.
Definition: Type.cpp:199
bool AlreadySearched(lldb_private::SymbolFile *sym_file)
Check if a SymbolFile object has already been searched by this type match object.
Definition: Type.cpp:189
TypeMap m_type_map
Matching types get added to this map as type search continues.
Definition: Type.h:391
Type * m_encoding_type
Definition: Type.h:581
CompilerType m_compiler_type
Definition: Type.h:587
CompilerType GetForwardCompilerType()
Definition: Type.cpp:774
lldb::Format GetFormat()
Definition: Type.cpp:526
Declaration m_decl
Definition: Type.h:586
Type * GetEncodingType()
Definition: Type.cpp:452
ConstString GetName()
Definition: Type.cpp:440
const lldb_private::Declaration & GetDeclaration() const
Definition: Type.cpp:576
uint64_t m_byte_size_has_value
Definition: Type.h:585
bool IsTemplateType()
Definition: Type.cpp:512
ResolveState m_compiler_type_resolve_state
Definition: Type.h:588
ConstString m_name
Definition: Type.h:577
uint32_t GetEncodingMask()
Definition: Type.cpp:755
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name, ExecutionContextScope *exe_scope)
Definition: Type.cpp:304
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes)
Definition: Type.cpp:504
SymbolContextScope * m_context
The symbol context in which this type is defined.
Definition: Type.h:580
lldb::user_id_t m_encoding_uid
Definition: Type.h:582
@ eEncodingIsRestrictUID
This type is the type whose UID is m_encoding_uid with the restrict qualifier added.
Definition: Type.h:429
@ eEncodingIsConstUID
This type is the type whose UID is m_encoding_uid with the const qualifier added.
Definition: Type.h:426
@ eEncodingIsVolatileUID
This type is the type whose UID is m_encoding_uid with the volatile qualifier added.
Definition: Type.h:432
@ eEncodingIsAtomicUID
This type is the type whose UID is m_encoding_uid as an atomic type.
Definition: Type.h:442
@ eEncodingIsLLVMPtrAuthUID
This type is a signed pointer.
Definition: Type.h:446
@ eEncodingIsSyntheticUID
This type is the synthetic type whose UID is m_encoding_uid.
Definition: Type.h:444
@ eEncodingInvalid
Invalid encoding.
Definition: Type.h:421
@ eEncodingIsTypedefUID
This type is alias to a type whose UID is m_encoding_uid.
Definition: Type.h:434
@ eEncodingIsPointerUID
This type is pointer to a type whose UID is m_encoding_uid.
Definition: Type.h:436
@ eEncodingIsLValueReferenceUID
This type is L value reference to a type whose UID is m_encoding_uid.
Definition: Type.h:438
@ eEncodingIsRValueReferenceUID
This type is R value reference to a type whose UID is m_encoding_uid.
Definition: Type.h:440
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
Definition: Type.h:423
Payload m_payload
Language-specific flags.
Definition: Type.h:590
SymbolFile * GetSymbolFile()
Definition: Type.h:476
void Dump(Stream *s, bool show_context, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
Definition: Type.cpp:372
CompilerType GetLayoutCompilerType()
Definition: Type.cpp:769
lldb::Encoding GetEncoding(uint64_t &count)
Definition: Type.cpp:528
lldb::ModuleSP GetExeModule()
GetModule may return module for compile unit's object file.
Definition: Type.cpp:847
void DumpTypeName(Stream *s)
Definition: Type.cpp:450
static std::optional< ParsedName > GetTypeScopeAndBasename(llvm::StringRef name)
Definition: Type.cpp:784
lldb::TypeSP GetTypedefType()
Definition: Type.cpp:516
bool ResolveCompilerType(ResolveState compiler_type_resolve_state)
Definition: Type.cpp:578
SymbolFile * m_symbol_file
Definition: Type.h:578
bool IsAggregateType()
Definition: Type.cpp:508
EncodingDataType m_encoding_uid_type
Definition: Type.h:583
uint64_t m_byte_size
Definition: Type.h:584
std::optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope)
Definition: Type.cpp:458
bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition: Type.cpp:533
ConstString GetBaseName()
Definition: Type.cpp:446
ConstString GetQualifiedName()
Definition: Type.cpp:779
CompilerType GetFullCompilerType()
Definition: Type.cpp:764
lldb::ModuleSP GetModule()
Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sur...
Definition: Type.cpp:841
bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition: Type.cpp:571
bool IsTypedef()
Definition: Type.h:494
#define LLDB_INVALID_UID
Definition: lldb-defines.h:88
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:332
@ AnyDeclContext
Math any declaration context.
Stream & operator<<(Stream &s, const Mangled &obj)
@ 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:374
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:461
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:82
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:336
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
Definition: lldb-forward.h:464
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:373
CompilerContext allows an array of these items to be passed to perform detailed lookups in SymbolVend...
Definition: Type.h:52
void Dump(Stream &s) const
Definition: Type.cpp:205
CompilerContextKind kind
Definition: Type.h:62
A SmallBitVector that represents a set of source languages (lldb::LanguageType).
Definition: Type.h:38
llvm::SmallVector< llvm::StringRef > scope
Definition: Type.h:543
lldb::TypeClass type_class
Definition: Type.h:539
llvm::StringRef basename
Definition: Type.h:545
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