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 <memory>
13#include <optional>
14
15#include "lldb/Core/Module.h"
19#include "lldb/Utility/Log.h"
20#include "lldb/Utility/Scalar.h"
22
28#include "lldb/Symbol/Type.h"
31
33#include "lldb/Target/Process.h"
34#include "lldb/Target/Target.h"
37
38#include "llvm/ADT/StringRef.h"
39
40using namespace lldb;
41using namespace lldb_private;
42
43llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &os,
44 const CompilerContext &rhs) {
45 StreamString lldb_stream;
46 rhs.Dump(lldb_stream);
47 return os << lldb_stream.GetString();
48}
49
50static CompilerContextKind ConvertTypeClass(lldb::TypeClass type_class) {
51 if (type_class == eTypeClassAny)
53 CompilerContextKind result = {};
54 if (type_class & (lldb::eTypeClassClass | lldb::eTypeClassStruct))
56 if (type_class & lldb::eTypeClassUnion)
58 if (type_class & lldb::eTypeClassEnumeration)
60 if (type_class & lldb::eTypeClassFunction)
62 if (type_class & lldb::eTypeClassTypedef)
64 return result;
65}
66
67TypeQuery::TypeQuery(llvm::StringRef name, TypeQueryOptions options)
68 : m_options(options) {
69 if (std::optional<Type::ParsedName> parsed_name =
71 llvm::ArrayRef scope = parsed_name->scope;
72 if (!scope.empty()) {
73 if (scope[0] == "::") {
74 m_options |= e_exact_match;
75 scope = scope.drop_front();
76 }
77 for (llvm::StringRef s : scope) {
78 m_context.push_back(
80 }
81 }
82 m_context.push_back({ConvertTypeClass(parsed_name->type_class),
83 ConstString(parsed_name->basename)});
84 } else {
86 }
87}
88
90 ConstString type_basename, TypeQueryOptions options)
91 : m_options(options) {
92 // Always use an exact match if we are looking for a type in compiler context.
93 m_options |= e_exact_match;
94 m_context = decl_ctx.GetCompilerContext();
95 m_context.push_back({CompilerContextKind::AnyType, type_basename});
96}
97
99 const llvm::ArrayRef<lldb_private::CompilerContext> &context,
100 TypeQueryOptions options)
101 : m_context(context), m_options(options) {
102 // Always use an exact match if we are looking for a type in compiler context.
103 m_options |= e_exact_match;
104}
105
106TypeQuery::TypeQuery(const CompilerDecl &decl, TypeQueryOptions options)
107 : m_options(options) {
108 // Always for an exact match if we are looking for a type using a declaration.
109 m_options |= e_exact_match;
111}
112
114 if (m_context.empty())
115 return ConstString();
116 return m_context.back().name;
117}
118
120 if (!m_languages)
122 m_languages->Insert(language);
123}
124
126 m_languages = std::move(languages);
127}
128
130 llvm::ArrayRef<CompilerContext> context_chain) const {
131 auto ctx = context_chain.rbegin(), ctx_end = context_chain.rend();
132 for (auto pat = m_context.rbegin(), pat_end = m_context.rend();
133 pat != pat_end;) {
134
135 if (ctx == ctx_end)
136 return false; // Pattern too long.
137
138 if (ctx->kind == CompilerContextKind::Namespace && ctx->name.IsEmpty()) {
139 // We're matching an anonymous namespace. These are optional, so we check
140 // if the pattern expects an anonymous namespace.
141 if (pat->name.IsEmpty() && (pat->kind & CompilerContextKind::Namespace) ==
143 // Match, advance both iterators.
144 ++pat;
145 }
146 // Otherwise, only advance the context to skip over the anonymous
147 // namespace, and try matching again.
148 ++ctx;
149 continue;
150 }
151
152 // See if there is a kind mismatch; they should have 1 bit in common.
153 if ((ctx->kind & pat->kind) == CompilerContextKind())
154 return false;
155
156 if (ctx->name != pat->name)
157 return false;
158
159 ++ctx;
160 ++pat;
161 }
162
163 // Skip over any remaining module and anonymous namespace entries if we were
164 // asked to do that.
165 auto should_skip = [this](const CompilerContext &ctx) {
166 if (ctx.kind == CompilerContextKind::Module)
167 return GetIgnoreModules();
168 if (ctx.kind == CompilerContextKind::Namespace && ctx.name.IsEmpty())
169 return !GetStrictNamespaces();
170 return false;
171 };
172 ctx = std::find_if_not(ctx, ctx_end, should_skip);
173
174 // At this point, we have exhausted the pattern and we have a partial match at
175 // least. If that's all we're looking for, we're done.
176 if (!GetExactMatch())
177 return true;
178
179 // We have an exact match if we've exhausted the target context as well.
180 return ctx == ctx_end;
181}
182
184 // If we have no language filterm language always matches.
185 if (!m_languages.has_value())
186 return true;
187 return (*m_languages)[language];
188}
189
191 return !m_searched_symbol_files.insert(sym_file).second;
192}
193
195 if (type_sp)
196 return m_type_map.InsertUnique(type_sp);
197 return false;
198}
199
200bool TypeResults::Done(const TypeQuery &query) const {
201 if (query.GetFindOne())
202 return !m_type_map.Empty();
203 return false;
204}
205
207 switch (kind) {
208 default:
209 s << "Invalid";
210 break;
212 s << "TranslationUnit";
213 break;
215 s << "Module";
216 break;
218 s << "Namespace";
219 break;
221 s << "ClassOrStruct";
222 break;
224 s << "Union";
225 break;
227 s << "Function";
228 break;
230 s << "Variable";
231 break;
233 s << "Enumeration";
234 break;
236 s << "Typedef";
237 break;
239 s << "AnyType";
240 break;
241 }
242 s << "(" << name << ")";
243}
244
246public:
247 TypeAppendVisitor(TypeListImpl &type_list) : m_type_list(type_list) {}
248
249 bool operator()(const lldb::TypeSP &type) {
250 m_type_list.Append(std::make_shared<TypeImpl>(type));
251 return true;
252 }
253
254private:
256};
257
259 TypeAppendVisitor cb(*this);
260 type_list.ForEach(cb);
261}
262
264 const lldb::TypeSP &type_sp)
265 : UserID(type_sp ? type_sp->GetID() : LLDB_INVALID_UID),
266 m_symbol_file(symbol_file), m_type_sp(type_sp) {}
267
269 if (!m_type_sp) {
270 Type *resolved_type = m_symbol_file.ResolveTypeUID(GetID());
271 if (resolved_type)
272 m_type_sp = resolved_type->shared_from_this();
273 }
274 return m_type_sp.get();
275}
276
278 std::optional<uint64_t> byte_size, SymbolContextScope *context,
279 user_id_t encoding_uid, EncodingDataType encoding_uid_type,
280 const Declaration &decl, const CompilerType &compiler_type,
281 ResolveState compiler_type_resolve_state, uint32_t opaque_payload)
282 : std::enable_shared_from_this<Type>(), UserID(uid), m_name(name),
283 m_symbol_file(symbol_file), m_context(context),
284 m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type),
285 m_decl(decl), m_compiler_type(compiler_type),
286 m_compiler_type_resolve_state(compiler_type ? compiler_type_resolve_state
288 m_payload(opaque_payload) {
289 if (byte_size) {
290 m_byte_size = *byte_size;
292 } else {
293 m_byte_size = 0;
294 m_byte_size_has_value = false;
295 }
296}
297
299 : std::enable_shared_from_this<Type>(), UserID(0), m_name("<INVALID TYPE>"),
300 m_payload(0) {
301 m_byte_size = 0;
302 m_byte_size_has_value = false;
303}
304
306 bool show_name, ExecutionContextScope *exe_scope) {
307 *s << "id = " << (const UserID &)*this;
308
309 // Call the name accessor to make sure we resolve the type name
310 if (show_name) {
311 ConstString type_name = GetName();
312 if (type_name) {
313 *s << ", name = \"" << type_name << '"';
314 ConstString qualified_type_name(GetQualifiedName());
315 if (qualified_type_name != type_name) {
316 *s << ", qualified = \"" << qualified_type_name << '"';
317 }
318 }
319 }
320
321 // Call the get byte size accessor so we resolve our byte size
322 if (GetByteSize(exe_scope))
323 s->Printf(", byte-size = %" PRIu64, m_byte_size);
324 bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
325 m_decl.Dump(s, show_fullpaths);
326
327 if (m_compiler_type.IsValid()) {
328 *s << ", compiler_type = \"";
330 *s << '"';
331 } else if (m_encoding_uid != LLDB_INVALID_UID) {
332 s->Printf(", type_uid = 0x%8.8" PRIx64, m_encoding_uid);
333 switch (m_encoding_uid_type) {
334 case eEncodingInvalid:
335 break;
336 case eEncodingIsUID:
337 s->PutCString(" (unresolved type)");
338 break;
340 s->PutCString(" (unresolved const type)");
341 break;
343 s->PutCString(" (unresolved restrict type)");
344 break;
346 s->PutCString(" (unresolved volatile type)");
347 break;
349 s->PutCString(" (unresolved atomic type)");
350 break;
352 s->PutCString(" (unresolved typedef)");
353 break;
355 s->PutCString(" (unresolved pointer)");
356 break;
358 s->PutCString(" (unresolved L value reference)");
359 break;
361 s->PutCString(" (unresolved R value reference)");
362 break;
364 s->PutCString(" (synthetic type)");
365 break;
367 s->PutCString(" (ptrauth type)");
368 break;
369 }
370 }
371}
372
373void Type::Dump(Stream *s, bool show_context, lldb::DescriptionLevel level) {
374 s->Printf("%p: ", static_cast<void *>(this));
375 s->Indent();
376 *s << "Type" << static_cast<const UserID &>(*this) << ' ';
377 if (m_name)
378 *s << ", name = \"" << m_name << "\"";
379
381 s->Printf(", size = %" PRIu64, m_byte_size);
382
383 if (show_context && m_context != nullptr) {
384 s->PutCString(", context = ( ");
385 m_context->DumpSymbolContext(s);
386 s->PutCString(" )");
387 }
388
389 bool show_fullpaths = false;
390 m_decl.Dump(s, show_fullpaths);
391
392 if (m_compiler_type.IsValid()) {
393 *s << ", compiler_type = " << m_compiler_type.GetOpaqueQualType() << ' ';
395 } else if (m_encoding_uid != LLDB_INVALID_UID) {
396 s->Format(", type_data = {0:x-16}", m_encoding_uid);
397 switch (m_encoding_uid_type) {
398 case eEncodingInvalid:
399 break;
400 case eEncodingIsUID:
401 s->PutCString(" (unresolved type)");
402 break;
404 s->PutCString(" (unresolved const type)");
405 break;
407 s->PutCString(" (unresolved restrict type)");
408 break;
410 s->PutCString(" (unresolved volatile type)");
411 break;
413 s->PutCString(" (unresolved atomic type)");
414 break;
416 s->PutCString(" (unresolved typedef)");
417 break;
419 s->PutCString(" (unresolved pointer)");
420 break;
422 s->PutCString(" (unresolved L value reference)");
423 break;
425 s->PutCString(" (unresolved R value reference)");
426 break;
428 s->PutCString(" (synthetic type)");
429 break;
431 s->PutCString(" (ptrauth type)");
432 }
433 }
434
435 //
436 // if (m_access)
437 // s->Printf(", access = %u", m_access);
438 s->EOL();
439}
440
446
448 return GetForwardCompilerType().GetTypeName(/*BaseOnly*/ true);
449}
450
451void Type::DumpTypeName(Stream *s) { GetName().Dump(s, "<invalid-type-name>"); }
452
458
459llvm::Expected<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
461 return static_cast<uint64_t>(m_byte_size);
462
463 switch (m_encoding_uid_type) {
464 case eEncodingInvalid:
465 return llvm::createStringError("could not get type size: invalid encoding");
466
468 return llvm::createStringError(
469 "could not get type size: synthetic encoding");
470
471 case eEncodingIsUID:
477 Type *encoding_type = GetEncodingType();
478 if (encoding_type)
479 if (std::optional<uint64_t> size =
480 llvm::expectedToOptional(encoding_type->GetByteSize(exe_scope))) {
481 m_byte_size = *size;
483 return static_cast<uint64_t>(m_byte_size);
484 }
485
486 auto size_or_err = GetLayoutCompilerType().GetByteSize(exe_scope);
487 if (!size_or_err)
488 return size_or_err.takeError();
489 m_byte_size = *size_or_err;
491 return static_cast<uint64_t>(m_byte_size);
492 } break;
493
494 // If we are a pointer or reference, then this is just a pointer size;
499 if (ArchSpec arch = m_symbol_file->GetObjectFile()->GetArchitecture()) {
500 m_byte_size = arch.GetAddressByteSize();
502 return static_cast<uint64_t>(m_byte_size);
503 }
504 } break;
505 }
506 return llvm::createStringError(
507 "could not get type size: unexpected encoding");
508}
509
510llvm::Expected<uint32_t> Type::GetNumChildren(bool omit_empty_base_classes) {
511 return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr);
512}
513
517
521
523 lldb::TypeSP type_sp;
524 if (IsTypedef()) {
525 Type *typedef_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
526 if (typedef_type)
527 type_sp = typedef_type->shared_from_this();
528 }
529 return type_sp;
530}
531
533
535 // Make sure we resolve our type if it already hasn't been.
536 return GetForwardCompilerType().GetEncoding(count);
537}
538
540 AddressType address_type, DataExtractor &data) {
541 if (address_type == eAddressTypeFile) {
542 // Can't convert a file address to anything valid without more context
543 // (which Module it came from)
544 return false;
545 }
546
547 const uint64_t byte_size =
548 llvm::expectedToOptional(
549 GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope()
550 : nullptr))
551 .value_or(0);
552 if (data.GetByteSize() < byte_size) {
553 lldb::DataBufferSP data_sp(new DataBufferHeap(byte_size, '\0'));
554 data.SetData(data_sp);
555 }
556
557 uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
558 if (dst != nullptr) {
559 if (address_type == eAddressTypeHost) {
560 // The address is an address in this process, so just copy it
561 if (addr == 0)
562 return false;
563 memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
564 return true;
565 } else {
566 if (exe_ctx) {
567 Process *process = exe_ctx->GetProcessPtr();
568 if (process) {
570 return exe_ctx->GetProcessPtr()->ReadMemory(addr, dst, byte_size,
571 error) == byte_size;
572 }
573 }
574 }
575 }
576 return false;
577}
578
580 AddressType address_type, DataExtractor &data) {
581 return false;
582}
583
584const Declaration &Type::GetDeclaration() const { return m_decl; }
585
586bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) {
587 // TODO: This needs to consider the correct type system to use.
588 Type *encoding_type = nullptr;
589 if (!m_compiler_type.IsValid()) {
590 encoding_type = GetEncodingType();
591 if (encoding_type) {
592 switch (m_encoding_uid_type) {
593 case eEncodingIsUID: {
594 CompilerType encoding_compiler_type =
595 encoding_type->GetForwardCompilerType();
596 if (encoding_compiler_type.IsValid()) {
597 m_compiler_type = encoding_compiler_type;
599 encoding_type->m_compiler_type_resolve_state;
600 }
601 } break;
602
605 encoding_type->GetForwardCompilerType().AddConstModifier();
606 break;
607
611 break;
612
616 break;
617
620 encoding_type->GetForwardCompilerType().GetAtomicType();
621 break;
622
625 m_name.AsCString("__lldb_invalid_typedef_name"),
626 GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
627 m_name.Clear();
628 break;
629
632 encoding_type->GetForwardCompilerType().GetPointerType();
633 break;
634
638 break;
639
643 break;
644
648 m_payload);
649 break;
650
651 default:
652 llvm_unreachable("Unhandled encoding_data_type.");
653 }
654 } else {
655 // We have no encoding type, return void?
656 auto type_system_or_err =
657 m_symbol_file->GetTypeSystemForLanguage(eLanguageTypeC);
658 if (auto err = type_system_or_err.takeError()) {
660 GetLog(LLDBLog::Symbols), std::move(err),
661 "Unable to construct void type from TypeSystemClang: {0}");
662 } else {
663 CompilerType void_compiler_type;
664 auto ts = *type_system_or_err;
665 if (ts)
666 void_compiler_type = ts->GetBasicTypeFromAST(eBasicTypeVoid);
667 switch (m_encoding_uid_type) {
668 case eEncodingIsUID:
669 m_compiler_type = void_compiler_type;
670 break;
671
673 m_compiler_type = void_compiler_type.AddConstModifier();
674 break;
675
677 m_compiler_type = void_compiler_type.AddRestrictModifier();
678 break;
679
681 m_compiler_type = void_compiler_type.AddVolatileModifier();
682 break;
683
685 m_compiler_type = void_compiler_type.GetAtomicType();
686 break;
687
689 m_compiler_type = void_compiler_type.CreateTypedef(
690 m_name.AsCString("__lldb_invalid_typedef_name"),
691 GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
692 break;
693
695 m_compiler_type = void_compiler_type.GetPointerType();
696 break;
697
699 m_compiler_type = void_compiler_type.GetLValueReferenceType();
700 break;
701
703 m_compiler_type = void_compiler_type.GetRValueReferenceType();
704 break;
705
707 llvm_unreachable("Cannot handle eEncodingIsLLVMPtrAuthUID without "
708 "valid encoding_type");
709
710 default:
711 llvm_unreachable("Unhandled encoding_data_type.");
712 }
713 }
714 }
715
716 // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is
717 // set to eResolveStateUnresolved so we need to update it to say that we
718 // now have a forward declaration since that is what we created above.
719 if (m_compiler_type.IsValid())
721 }
722
723 // Check if we have a forward reference to a class/struct/union/enum?
724 if (compiler_type_resolve_state == ResolveState::Layout ||
725 compiler_type_resolve_state == ResolveState::Full) {
726 // Check if we have a forward reference to a class/struct/union/enum?
727 if (m_compiler_type.IsValid() &&
728 m_compiler_type_resolve_state < compiler_type_resolve_state) {
730 if (!m_compiler_type.IsDefined()) {
731 // We have a forward declaration, we need to resolve it to a complete
732 // definition.
733 m_symbol_file->CompleteType(m_compiler_type);
734 }
735 }
736 }
737
738 // If we have an encoding type, then we need to make sure it is resolved
739 // appropriately.
741 if (encoding_type == nullptr)
742 encoding_type = GetEncodingType();
743 if (encoding_type) {
744 ResolveState encoding_compiler_type_resolve_state =
745 compiler_type_resolve_state;
746
747 if (compiler_type_resolve_state == ResolveState::Layout) {
748 switch (m_encoding_uid_type) {
752 encoding_compiler_type_resolve_state = ResolveState::Forward;
753 break;
754 default:
755 break;
756 }
757 }
758 encoding_type->ResolveCompilerType(encoding_compiler_type_resolve_state);
759 }
760 }
761 return m_compiler_type.IsValid();
762}
764 uint32_t encoding_mask = 1u << m_encoding_uid_type;
765 Type *encoding_type = GetEncodingType();
766 assert(encoding_type != this);
767 if (encoding_type)
768 encoding_mask |= encoding_type->GetEncodingMask();
769 return encoding_mask;
770}
771
776
781
786
790
791std::optional<Type::ParsedName>
792Type::GetTypeScopeAndBasename(llvm::StringRef name) {
793 ParsedName result;
794
795 if (name.empty())
796 return std::nullopt;
797
798 if (name.consume_front("struct "))
799 result.type_class = eTypeClassStruct;
800 else if (name.consume_front("class "))
801 result.type_class = eTypeClassClass;
802 else if (name.consume_front("union "))
803 result.type_class = eTypeClassUnion;
804 else if (name.consume_front("enum "))
805 result.type_class = eTypeClassEnumeration;
806 else if (name.consume_front("typedef "))
807 result.type_class = eTypeClassTypedef;
808
809 if (name.consume_front("::"))
810 result.scope.push_back("::");
811
812 bool prev_is_colon = false;
813 size_t template_depth = 0;
814 size_t name_begin = 0;
815 for (const auto &pos : llvm::enumerate(name)) {
816 switch (pos.value()) {
817 case ':':
818 if (prev_is_colon && template_depth == 0) {
819 llvm::StringRef scope_name = name.slice(name_begin, pos.index() - 1);
820 // The demanglers use these strings to represent anonymous
821 // namespaces. Convert it to a more language-agnostic form (which is
822 // also used in DWARF).
823 if (scope_name == "(anonymous namespace)" ||
824 scope_name == "`anonymous namespace'" ||
825 scope_name == "`anonymous-namespace'")
826 scope_name = "";
827 result.scope.push_back(scope_name);
828 name_begin = pos.index() + 1;
829 }
830 break;
831 case '<':
832 ++template_depth;
833 break;
834 case '>':
835 if (template_depth == 0)
836 return std::nullopt; // Invalid name.
837 --template_depth;
838 break;
839 }
840 prev_is_colon = pos.value() == ':';
841 }
842
843 if (name_begin < name.size() && template_depth == 0)
844 result.basename = name.substr(name_begin);
845 else
846 return std::nullopt;
847
848 return result;
849}
850
852 if (m_symbol_file)
853 return m_symbol_file->GetObjectFile()->GetModule();
854 return ModuleSP();
855}
856
858 if (m_compiler_type) {
859 auto ts = m_compiler_type.GetTypeSystem();
860 if (!ts)
861 return {};
862 SymbolFile *symbol_file = ts->GetSymbolFile();
863 if (symbol_file)
864 return symbol_file->GetObjectFile()->GetModule();
865 }
866 return {};
867}
868
870 if (in_type_sp) {
871 m_compiler_type = in_type_sp->GetForwardCompilerType();
872 m_type_name = in_type_sp->GetName();
873 }
874}
875
876TypeAndOrName::TypeAndOrName(const char *in_type_str)
877 : m_type_name(in_type_str) {}
878
880 : m_type_name(in_type_const_string) {}
881
882bool TypeAndOrName::operator==(const TypeAndOrName &other) const {
883 if (m_compiler_type != other.m_compiler_type)
884 return false;
885 if (m_type_name != other.m_type_name)
886 return false;
887 return true;
888}
889
890bool TypeAndOrName::operator!=(const TypeAndOrName &other) const {
891 return !(*this == other);
892}
893
895 if (m_type_name)
896 return m_type_name;
897 if (m_compiler_type)
898 return m_compiler_type.GetTypeName();
899 return ConstString("<invalid>");
900}
901
903 m_type_name = type_name;
904}
905
906void TypeAndOrName::SetName(const char *type_name_cstr) {
907 m_type_name.SetCString(type_name_cstr);
908}
909
910void TypeAndOrName::SetName(llvm::StringRef type_name) {
911 m_type_name.SetString(type_name);
912}
913
915 if (type_sp) {
916 m_compiler_type = type_sp->GetForwardCompilerType();
917 m_type_name = type_sp->GetName();
918 } else
919 Clear();
920}
921
923 m_compiler_type = compiler_type;
924 if (m_compiler_type)
925 m_type_name = m_compiler_type.GetTypeName();
926}
927
929 return !((bool)m_type_name || (bool)m_compiler_type);
930}
931
933 m_type_name.Clear();
934 m_compiler_type.Clear();
935}
936
937bool TypeAndOrName::HasName() const { return (bool)m_type_name; }
938
940 return m_compiler_type.IsValid();
941}
942
945 SetType(type_sp);
946}
947
948TypeImpl::TypeImpl(const CompilerType &compiler_type)
950 SetType(compiler_type);
951}
952
953TypeImpl::TypeImpl(const lldb::TypeSP &type_sp, const CompilerType &dynamic)
954 : m_module_wp(), m_static_type(), m_dynamic_type(dynamic) {
955 SetType(type_sp, dynamic);
956}
957
959 const CompilerType &dynamic_type)
961 SetType(static_type, dynamic_type);
962}
963
964void TypeImpl::SetType(const lldb::TypeSP &type_sp) {
965 if (type_sp) {
966 m_static_type = type_sp->GetForwardCompilerType();
967 m_exe_module_wp = type_sp->GetExeModule();
968 m_module_wp = type_sp->GetModule();
969 } else {
970 m_static_type.Clear();
972 }
973}
974
975void TypeImpl::SetType(const CompilerType &compiler_type) {
977 m_static_type = compiler_type;
978}
979
980void TypeImpl::SetType(const lldb::TypeSP &type_sp,
981 const CompilerType &dynamic) {
982 SetType(type_sp);
983 m_dynamic_type = dynamic;
984}
985
986void TypeImpl::SetType(const CompilerType &compiler_type,
987 const CompilerType &dynamic) {
989 m_static_type = compiler_type;
990 m_dynamic_type = dynamic;
991}
992
993bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const {
994 return CheckModuleCommon(m_module_wp, module_sp);
995}
996
998 return CheckModuleCommon(m_exe_module_wp, module_sp);
999}
1000
1002 lldb::ModuleSP &module_sp) const {
1003 // Check if we have a module for this type. If we do and the shared pointer
1004 // is can be successfully initialized with m_module_wp, return true. Else
1005 // return false if we didn't have a module, or if we had a module and it has
1006 // been deleted. Any functions doing anything with a TypeSP in this TypeImpl
1007 // class should call this function and only do anything with the ivars if
1008 // this function returns true. If we have a module, the "module_sp" will be
1009 // filled in with a strong reference to the module so that the module will at
1010 // least stay around long enough for the type query to succeed.
1011 module_sp = input_module_wp.lock();
1012 if (!module_sp) {
1013 lldb::ModuleWP empty_module_wp;
1014 // If either call to "std::weak_ptr::owner_before(...) value returns true,
1015 // this indicates that m_module_wp once contained (possibly still does) a
1016 // reference to a valid shared pointer. This helps us know if we had a
1017 // valid reference to a section which is now invalid because the module it
1018 // was in was deleted
1019 if (empty_module_wp.owner_before(input_module_wp) ||
1020 input_module_wp.owner_before(empty_module_wp)) {
1021 // input_module_wp had a valid reference to a module, but all strong
1022 // references have been released and the module has been deleted
1023 return false;
1024 }
1025 }
1026 // We either successfully locked the module, or didn't have one to begin with
1027 return true;
1028}
1029
1030bool TypeImpl::operator==(const TypeImpl &rhs) const {
1031 return m_static_type == rhs.m_static_type &&
1033}
1034
1035bool TypeImpl::operator!=(const TypeImpl &rhs) const {
1036 return !(*this == rhs);
1037}
1038
1039bool TypeImpl::IsValid() const {
1040 // just a name is not valid
1041 ModuleSP module_sp;
1042 if (CheckModule(module_sp))
1043 return m_static_type.IsValid() || m_dynamic_type.IsValid();
1044 return false;
1045}
1046
1047TypeImpl::operator bool() const { return IsValid(); }
1048
1051 m_static_type.Clear();
1052 m_dynamic_type.Clear();
1053}
1054
1056 lldb::ModuleSP module_sp;
1057 if (CheckExeModule(module_sp))
1058 return module_sp;
1059 return nullptr;
1060}
1061
1063 ModuleSP module_sp;
1064 if (CheckModule(module_sp)) {
1065 if (m_dynamic_type)
1066 return m_dynamic_type.GetTypeName();
1067 return m_static_type.GetTypeName();
1068 }
1069 return ConstString();
1070}
1071
1073 ModuleSP module_sp;
1074 if (CheckModule(module_sp)) {
1075 if (m_dynamic_type)
1076 return m_dynamic_type.GetDisplayTypeName();
1077 return m_static_type.GetDisplayTypeName();
1078 }
1079 return ConstString();
1080}
1081
1083 ModuleSP module_sp;
1084 if (CheckModule(module_sp)) {
1085 if (m_dynamic_type.IsValid()) {
1086 return TypeImpl(m_static_type.GetPointerType(),
1087 m_dynamic_type.GetPointerType());
1088 }
1089 return TypeImpl(m_static_type.GetPointerType());
1090 }
1091 return TypeImpl();
1092}
1093
1095 ModuleSP module_sp;
1096 if (CheckModule(module_sp)) {
1097 if (m_dynamic_type.IsValid()) {
1098 return TypeImpl(m_static_type.GetPointeeType(),
1099 m_dynamic_type.GetPointeeType());
1100 }
1101 return TypeImpl(m_static_type.GetPointeeType());
1102 }
1103 return TypeImpl();
1104}
1105
1107 ModuleSP module_sp;
1108 if (CheckModule(module_sp)) {
1109 if (m_dynamic_type.IsValid()) {
1110 return TypeImpl(m_static_type.GetLValueReferenceType(),
1111 m_dynamic_type.GetLValueReferenceType());
1112 }
1113 return TypeImpl(m_static_type.GetLValueReferenceType());
1114 }
1115 return TypeImpl();
1116}
1117
1119 ModuleSP module_sp;
1120 if (CheckModule(module_sp)) {
1121 if (m_dynamic_type.IsValid()) {
1122 return TypeImpl(m_static_type.GetTypedefedType(),
1123 m_dynamic_type.GetTypedefedType());
1124 }
1125 return TypeImpl(m_static_type.GetTypedefedType());
1126 }
1127 return TypeImpl();
1128}
1129
1131 ModuleSP module_sp;
1132 if (CheckModule(module_sp)) {
1133 if (m_dynamic_type.IsValid()) {
1134 return TypeImpl(m_static_type.GetNonReferenceType(),
1135 m_dynamic_type.GetNonReferenceType());
1136 }
1137 return TypeImpl(m_static_type.GetNonReferenceType());
1138 }
1139 return TypeImpl();
1140}
1141
1143 ModuleSP module_sp;
1144 if (CheckModule(module_sp)) {
1145 if (m_dynamic_type.IsValid()) {
1146 return TypeImpl(m_static_type.GetFullyUnqualifiedType(),
1147 m_dynamic_type.GetFullyUnqualifiedType());
1148 }
1149 return TypeImpl(m_static_type.GetFullyUnqualifiedType());
1150 }
1151 return TypeImpl();
1152}
1153
1155 ModuleSP module_sp;
1156 if (CheckModule(module_sp)) {
1157 if (m_dynamic_type.IsValid()) {
1158 return TypeImpl(m_static_type.GetCanonicalType(),
1159 m_dynamic_type.GetCanonicalType());
1160 }
1161 return TypeImpl(m_static_type.GetCanonicalType());
1162 }
1163 return TypeImpl();
1164}
1165
1167 ModuleSP module_sp;
1168 if (CheckModule(module_sp)) {
1169 if (prefer_dynamic) {
1170 if (m_dynamic_type.IsValid())
1171 return m_dynamic_type;
1172 }
1173 return m_static_type;
1174 }
1175 return CompilerType();
1176}
1177
1179 ModuleSP module_sp;
1180 if (CheckModule(module_sp)) {
1181 if (prefer_dynamic) {
1182 if (m_dynamic_type.IsValid())
1183 return m_dynamic_type.GetTypeSystem();
1184 }
1185 return m_static_type.GetTypeSystem();
1186 }
1187 return {};
1188}
1189
1191 lldb::DescriptionLevel description_level) {
1192 ModuleSP module_sp;
1193 if (CheckModule(module_sp)) {
1194 if (m_dynamic_type.IsValid()) {
1195 strm.Printf("Dynamic:\n");
1196 m_dynamic_type.DumpTypeDescription(&strm);
1197 strm.Printf("\nStatic:\n");
1198 }
1199 m_static_type.DumpTypeDescription(&strm);
1200 } else {
1201 strm.PutCString("Invalid TypeImpl module for type has been deleted\n");
1202 }
1203 return true;
1204}
1205
1207 if (name.empty())
1208 return CompilerType();
1209 return GetCompilerType(/*prefer_dynamic=*/false)
1211}
1212
1216
1218
1220 return m_decl.GetMangledName();
1221}
1222
1224
1228
1230 switch (m_kind) {
1232 return false;
1234 stream.Printf("constructor for %s",
1235 m_type.GetTypeName().AsCString("<unknown>"));
1236 break;
1238 stream.Printf("destructor for %s",
1239 m_type.GetTypeName().AsCString("<unknown>"));
1240 break;
1242 stream.Printf("instance method %s of type %s", m_name.AsCString(),
1243 m_decl.GetDeclContext().GetName().AsCString());
1244 break;
1246 stream.Printf("static method %s of type %s", m_name.AsCString(),
1247 m_decl.GetDeclContext().GetName().AsCString());
1248 break;
1249 }
1250 return true;
1251}
1252
1254 if (m_type)
1255 return m_type.GetFunctionReturnType();
1256 return m_decl.GetFunctionReturnType();
1257}
1258
1260 if (m_type)
1261 return m_type.GetNumberOfFunctionArguments();
1262 else
1263 return m_decl.GetNumFunctionArguments();
1264}
1265
1267 if (m_type)
1268 return m_type.GetFunctionArgumentAtIndex(idx);
1269 else
1270 return m_decl.GetFunctionArgumentType(idx);
1271}
1272
1274 ConstString name,
1275 const llvm::APSInt &value)
1276 : m_integer_type_sp(integer_type_sp), m_name(name), m_value(value),
1277 m_valid((bool)name && (bool)integer_type_sp)
1278
1279{}
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:50
bool operator()(const lldb::TypeSP &type)
Definition Type.cpp:249
TypeListImpl & m_type_list
Definition Type.cpp:255
TypeAppendVisitor(TypeListImpl &type_list)
Definition Type.cpp:247
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.
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...
Generic representation of a type in a programming language.
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
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
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.
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope) const
Return the size of the type in bytes.
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 GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
ConstString GetTypeName(bool BaseOnly=false) const
lldb::Format GetFormat() const
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 GetAtomicType() const
Return a new CompilerType that is the atomic type of this type.
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 Dump(Stream *s, const char *value_if_empty=nullptr) const
Dump the object description to a stream.
A subclass of DataBuffer that stores a data buffer on the heap.
An data extractor class.
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
"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.
A plug-in interface definition class for debugging a process.
Definition Process.h:357
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:1930
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:352
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...
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:51
virtual ObjectFile * GetObjectFile()=0
void SetName(ConstString type_name)
Definition Type.cpp:902
bool operator!=(const TypeAndOrName &other) const
Definition Type.cpp:890
bool operator==(const TypeAndOrName &other) const
Definition Type.cpp:882
ConstString GetName() const
Definition Type.cpp:894
bool HasCompilerType() const
Definition Type.cpp:939
void SetCompilerType(CompilerType compiler_type)
Definition Type.cpp:922
ConstString m_type_name
Definition Type.h:819
void SetTypeSP(lldb::TypeSP type_sp)
Definition Type.cpp:914
CompilerType m_compiler_type
Definition Type.h:818
lldb::TypeImplSP m_integer_type_sp
Definition Type.h:881
CompilerType GetCompilerType(bool prefer_dynamic)
Definition Type.cpp:1166
bool operator!=(const TypeImpl &rhs) const
Definition Type.cpp:1035
bool CheckExeModule(lldb::ModuleSP &module_sp) const
Definition Type.cpp:997
bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level)
Definition Type.cpp:1190
bool operator==(const TypeImpl &rhs) const
Definition Type.cpp:1030
bool CheckModuleCommon(const lldb::ModuleWP &input_module_wp, lldb::ModuleSP &module_sp) const
Definition Type.cpp:1001
TypeImpl GetCanonicalType() const
Definition Type.cpp:1154
void SetType(const lldb::TypeSP &type_sp)
Definition Type.cpp:964
TypeImpl GetUnqualifiedType() const
Definition Type.cpp:1142
TypeImpl GetPointeeType() const
Definition Type.cpp:1094
CompilerType m_dynamic_type
Definition Type.h:694
CompilerType::TypeSystemSPWrapper GetTypeSystem(bool prefer_dynamic)
Definition Type.cpp:1178
CompilerType m_static_type
Definition Type.h:693
bool CheckModule(lldb::ModuleSP &module_sp) const
Definition Type.cpp:993
lldb::ModuleSP GetModule() const
Definition Type.cpp:1055
TypeImpl GetDereferencedType() const
Definition Type.cpp:1130
bool IsValid() const
Definition Type.cpp:1039
TypeImpl GetPointerType() const
Definition Type.cpp:1082
lldb::ModuleWP m_exe_module_wp
Definition Type.h:692
TypeImpl GetReferenceType() const
Definition Type.cpp:1106
TypeImpl GetTypedefedType() const
Definition Type.cpp:1118
lldb::ModuleWP m_module_wp
Definition Type.h:691
ConstString GetName() const
Definition Type.cpp:1062
CompilerType FindDirectNestedType(llvm::StringRef name)
Definition Type.cpp:1206
ConstString GetDisplayTypeName() const
Definition Type.cpp:1072
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
CompilerType GetReturnType() const
Definition Type.cpp:1253
ConstString GetMangledName() const
Definition Type.cpp:1219
CompilerType GetType() const
Definition Type.cpp:1223
CompilerType GetArgumentAtIndex(size_t idx) const
Definition Type.cpp:1266
bool GetDescription(Stream &stream)
Definition Type.cpp:1229
lldb::MemberFunctionKind GetKind() const
Definition Type.cpp:1225
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:119
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:183
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:125
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:113
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:129
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:194
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:200
bool AlreadySearched(lldb_private::SymbolFile *sym_file)
Check if a SymbolFile object has already been searched by this type match object.
Definition Type.cpp:190
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:782
lldb::Format GetFormat()
Definition Type.cpp:532
Declaration m_decl
Definition Type.h:586
Type * GetEncodingType()
Definition Type.cpp:453
ConstString GetName()
Definition Type.cpp:441
const lldb_private::Declaration & GetDeclaration() const
Definition Type.cpp:584
uint64_t m_byte_size_has_value
Definition Type.h:585
bool IsTemplateType()
Definition Type.cpp:518
ResolveState m_compiler_type_resolve_state
Definition Type.h:588
ConstString m_name
Definition Type.h:577
uint32_t GetEncodingMask()
Definition Type.cpp:763
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name, ExecutionContextScope *exe_scope)
Definition Type.cpp:305
llvm::Expected< uint32_t > GetNumChildren(bool omit_empty_base_classes)
Definition Type.cpp:510
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:373
CompilerType GetLayoutCompilerType()
Definition Type.cpp:777
lldb::Encoding GetEncoding(uint64_t &count)
Definition Type.cpp:534
lldb::ModuleSP GetExeModule()
GetModule may return module for compile unit's object file.
Definition Type.cpp:857
void DumpTypeName(Stream *s)
Definition Type.cpp:451
static std::optional< ParsedName > GetTypeScopeAndBasename(llvm::StringRef name)
Definition Type.cpp:792
lldb::TypeSP GetTypedefType()
Definition Type.cpp:522
bool ResolveCompilerType(ResolveState compiler_type_resolve_state)
Definition Type.cpp:586
SymbolFile * m_symbol_file
Definition Type.h:578
bool IsAggregateType()
Definition Type.cpp:514
EncodingDataType m_encoding_uid_type
Definition Type.h:583
uint64_t m_byte_size
Definition Type.h:584
bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition Type.cpp:539
ConstString GetBaseName()
Definition Type.cpp:447
Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, std::optional< uint64_t > byte_size, SymbolContextScope *context, lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type, const Declaration &decl, const CompilerType &compiler_qual_type, ResolveState compiler_type_resolve_state, uint32_t opaque_payload=0)
Definition Type.cpp:277
ConstString GetQualifiedName()
Definition Type.cpp:787
CompilerType GetFullCompilerType()
Definition Type.cpp:772
llvm::Expected< uint64_t > GetByteSize(ExecutionContextScope *exe_scope)
Definition Type.cpp:459
lldb::ModuleSP GetModule()
Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sur...
Definition Type.cpp:851
bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition Type.cpp:579
bool IsTypedef()
Definition Type.h:494
#define LLDB_INVALID_UID
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.
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
@ eDescriptionLevelVerbose
std::weak_ptr< lldb_private::Module > ModuleWP
Format
Display format definitions.
LanguageType
Programming language type.
@ eLanguageTypeC
Non-standardized C, such as K&R.
std::shared_ptr< lldb_private::Type > TypeSP
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
uint64_t addr_t
Definition lldb-types.h:80
std::shared_ptr< lldb_private::TypeImpl > TypeImplSP
std::shared_ptr< lldb_private::Module > ModuleSP
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:206
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
UserID(lldb::user_id_t uid=LLDB_INVALID_UID)
Construct with optional user ID.
Definition UserID.h:33
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition UserID.h:47