LLDB  mainline
Type.cpp
Go to the documentation of this file.
1 //===-- Type.cpp ----------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <cstdio>
10 
11 #include "lldb/Core/Module.h"
14 #include "lldb/Utility/LLDBLog.h"
15 #include "lldb/Utility/Log.h"
16 #include "lldb/Utility/Scalar.h"
18 
20 #include "lldb/Symbol/ObjectFile.h"
22 #include "lldb/Symbol/SymbolFile.h"
24 #include "lldb/Symbol/Type.h"
25 #include "lldb/Symbol/TypeList.h"
26 #include "lldb/Symbol/TypeSystem.h"
27 
29 #include "lldb/Target/Process.h"
30 #include "lldb/Target/Target.h"
31 
32 #include "llvm/ADT/StringRef.h"
33 
34 using namespace lldb;
35 using namespace lldb_private;
36 
37 bool lldb_private::contextMatches(llvm::ArrayRef<CompilerContext> context_chain,
38  llvm::ArrayRef<CompilerContext> pattern) {
39  auto ctx = context_chain.begin();
40  auto ctx_end = context_chain.end();
41  for (const CompilerContext &pat : pattern) {
42  // Early exit if the pattern is too long.
43  if (ctx == ctx_end)
44  return false;
45  if (*ctx != pat) {
46  // Skip any number of module matches.
47  if (pat.kind == CompilerContextKind::AnyModule) {
48  // Greedily match 0..n modules.
49  ctx = std::find_if(ctx, ctx_end, [](const CompilerContext &ctx) {
50  return ctx.kind != CompilerContextKind::Module;
51  });
52  continue;
53  }
54  // See if there is a kind mismatch; they should have 1 bit in common.
55  if (((uint16_t)ctx->kind & (uint16_t)pat.kind) == 0)
56  return false;
57  // The name is ignored for AnyModule, but not for AnyType.
58  if (pat.kind != CompilerContextKind::AnyModule && ctx->name != pat.name)
59  return false;
60  }
61  ++ctx;
62  }
63  return true;
64 }
65 
66 void CompilerContext::Dump() const {
67  switch (kind) {
68  default:
69  printf("Invalid");
70  break;
71  case CompilerContextKind::TranslationUnit:
72  printf("TranslationUnit");
73  break;
74  case CompilerContextKind::Module:
75  printf("Module");
76  break;
77  case CompilerContextKind::Namespace:
78  printf("Namespace");
79  break;
80  case CompilerContextKind::Class:
81  printf("Class");
82  break;
83  case CompilerContextKind::Struct:
84  printf("Structure");
85  break;
86  case CompilerContextKind::Union:
87  printf("Union");
88  break;
89  case CompilerContextKind::Function:
90  printf("Function");
91  break;
92  case CompilerContextKind::Variable:
93  printf("Variable");
94  break;
95  case CompilerContextKind::Enum:
96  printf("Enumeration");
97  break;
98  case CompilerContextKind::Typedef:
99  printf("Typedef");
100  break;
101  case CompilerContextKind::AnyModule:
102  printf("AnyModule");
103  break;
104  case CompilerContextKind::AnyType:
105  printf("AnyType");
106  break;
107  }
108  printf("(\"%s\")\n", name.GetCString());
109 }
110 
112 public:
113  TypeAppendVisitor(TypeListImpl &type_list) : m_type_list(type_list) {}
114 
115  bool operator()(const lldb::TypeSP &type) {
116  m_type_list.Append(TypeImplSP(new TypeImpl(type)));
117  return true;
118  }
119 
120 private:
122 };
123 
124 void TypeListImpl::Append(const lldb_private::TypeList &type_list) {
125  TypeAppendVisitor cb(*this);
126  type_list.ForEach(cb);
127 }
128 
129 SymbolFileType::SymbolFileType(SymbolFile &symbol_file,
130  const lldb::TypeSP &type_sp)
131  : UserID(type_sp ? type_sp->GetID() : LLDB_INVALID_UID),
132  m_symbol_file(symbol_file), m_type_sp(type_sp) {}
133 
135  if (!m_type_sp) {
136  Type *resolved_type = m_symbol_file.ResolveTypeUID(GetID());
137  if (resolved_type)
138  m_type_sp = resolved_type->shared_from_this();
139  }
140  return m_type_sp.get();
141 }
142 
144  llvm::Optional<uint64_t> byte_size, SymbolContextScope *context,
145  user_id_t encoding_uid, EncodingDataType encoding_uid_type,
146  const Declaration &decl, const CompilerType &compiler_type,
147  ResolveState compiler_type_resolve_state, uint32_t opaque_payload)
148  : std::enable_shared_from_this<Type>(), UserID(uid), m_name(name),
149  m_symbol_file(symbol_file), m_context(context),
150  m_encoding_uid(encoding_uid), m_encoding_uid_type(encoding_uid_type),
151  m_decl(decl), m_compiler_type(compiler_type),
152  m_compiler_type_resolve_state(compiler_type ? compiler_type_resolve_state
153  : ResolveState::Unresolved),
154  m_payload(opaque_payload) {
155  if (byte_size) {
156  m_byte_size = *byte_size;
157  m_byte_size_has_value = true;
158  } else {
159  m_byte_size = 0;
160  m_byte_size_has_value = false;
161  }
162 }
163 
165  : std::enable_shared_from_this<Type>(), UserID(0),
166  m_name("<INVALID TYPE>") {
167  m_byte_size = 0;
168  m_byte_size_has_value = false;
169 }
170 
172  bool show_name, ExecutionContextScope *exe_scope) {
173  *s << "id = " << (const UserID &)*this;
174 
175  // Call the name accessor to make sure we resolve the type name
176  if (show_name) {
177  ConstString type_name = GetName();
178  if (type_name) {
179  *s << ", name = \"" << type_name << '"';
180  ConstString qualified_type_name(GetQualifiedName());
181  if (qualified_type_name != type_name) {
182  *s << ", qualified = \"" << qualified_type_name << '"';
183  }
184  }
185  }
186 
187  // Call the get byte size accesor so we resolve our byte size
188  if (GetByteSize(exe_scope))
189  s->Printf(", byte-size = %" PRIu64, m_byte_size);
190  bool show_fullpaths = (level == lldb::eDescriptionLevelVerbose);
191  m_decl.Dump(s, show_fullpaths);
192 
193  if (m_compiler_type.IsValid()) {
194  *s << ", compiler_type = \"";
196  *s << '"';
197  } else if (m_encoding_uid != LLDB_INVALID_UID) {
198  s->Printf(", type_uid = 0x%8.8" PRIx64, m_encoding_uid);
199  switch (m_encoding_uid_type) {
200  case eEncodingInvalid:
201  break;
202  case eEncodingIsUID:
203  s->PutCString(" (unresolved type)");
204  break;
205  case eEncodingIsConstUID:
206  s->PutCString(" (unresolved const type)");
207  break;
209  s->PutCString(" (unresolved restrict type)");
210  break;
212  s->PutCString(" (unresolved volatile type)");
213  break;
215  s->PutCString(" (unresolved atomic type)");
216  break;
218  s->PutCString(" (unresolved typedef)");
219  break;
221  s->PutCString(" (unresolved pointer)");
222  break;
224  s->PutCString(" (unresolved L value reference)");
225  break;
227  s->PutCString(" (unresolved R value reference)");
228  break;
230  s->PutCString(" (synthetic type)");
231  break;
232  }
233  }
234 }
235 
236 void Type::Dump(Stream *s, bool show_context, lldb::DescriptionLevel level) {
237  s->Printf("%p: ", static_cast<void *>(this));
238  s->Indent();
239  *s << "Type" << static_cast<const UserID &>(*this) << ' ';
240  if (m_name)
241  *s << ", name = \"" << m_name << "\"";
242 
244  s->Printf(", size = %" PRIu64, m_byte_size);
245 
246  if (show_context && m_context != nullptr) {
247  s->PutCString(", context = ( ");
249  s->PutCString(" )");
250  }
251 
252  bool show_fullpaths = false;
253  m_decl.Dump(s, show_fullpaths);
254 
255  if (m_compiler_type.IsValid()) {
256  *s << ", compiler_type = " << m_compiler_type.GetOpaqueQualType() << ' ';
258  } else if (m_encoding_uid != LLDB_INVALID_UID) {
259  s->Format(", type_data = {0:x-16}", m_encoding_uid);
260  switch (m_encoding_uid_type) {
261  case eEncodingInvalid:
262  break;
263  case eEncodingIsUID:
264  s->PutCString(" (unresolved type)");
265  break;
266  case eEncodingIsConstUID:
267  s->PutCString(" (unresolved const type)");
268  break;
270  s->PutCString(" (unresolved restrict type)");
271  break;
273  s->PutCString(" (unresolved volatile type)");
274  break;
276  s->PutCString(" (unresolved atomic type)");
277  break;
279  s->PutCString(" (unresolved typedef)");
280  break;
282  s->PutCString(" (unresolved pointer)");
283  break;
285  s->PutCString(" (unresolved L value reference)");
286  break;
288  s->PutCString(" (unresolved R value reference)");
289  break;
291  s->PutCString(" (synthetic type)");
292  break;
293  }
294  }
295 
296  //
297  // if (m_access)
298  // s->Printf(", access = %u", m_access);
299  s->EOL();
300 }
301 
303  if (!m_name)
305  return m_name;
306 }
307 
308 void Type::DumpTypeName(Stream *s) { GetName().Dump(s, "<invalid-type-name>"); }
309 
311  const DataExtractor &data, uint32_t data_byte_offset,
312  bool show_types, bool show_summary, bool verbose,
313  lldb::Format format) {
315  if (show_types) {
316  s->PutChar('(');
317  if (verbose)
318  s->Printf("Type{0x%8.8" PRIx64 "} ", GetID());
319  DumpTypeName(s);
320  s->PutCString(") ");
321  }
322 
324  exe_ctx, s, format == lldb::eFormatDefault ? GetFormat() : format, data,
325  data_byte_offset,
326  GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
327  .getValueOr(0),
328  0, // Bitfield bit size
329  0, // Bitfield bit offset
330  show_types, show_summary, verbose, 0);
331  }
332 }
333 
335  if (m_encoding_type == nullptr && m_encoding_uid != LLDB_INVALID_UID)
337  return m_encoding_type;
338 }
339 
340 llvm::Optional<uint64_t> Type::GetByteSize(ExecutionContextScope *exe_scope) {
342  return m_byte_size;
343 
344  switch (m_encoding_uid_type) {
345  case eEncodingInvalid:
347  break;
348  case eEncodingIsUID:
349  case eEncodingIsConstUID:
353  case eEncodingIsTypedefUID: {
354  Type *encoding_type = GetEncodingType();
355  if (encoding_type)
356  if (llvm::Optional<uint64_t> size = encoding_type->GetByteSize(exe_scope)) {
357  m_byte_size = *size;
358  m_byte_size_has_value = true;
359  return m_byte_size;
360  }
361 
362  if (llvm::Optional<uint64_t> size =
363  GetLayoutCompilerType().GetByteSize(exe_scope)) {
364  m_byte_size = *size;
365  m_byte_size_has_value = true;
366  return m_byte_size;
367  }
368  } break;
369 
370  // If we are a pointer or reference, then this is just a pointer size;
375  m_byte_size = arch.GetAddressByteSize();
376  m_byte_size_has_value = true;
377  return m_byte_size;
378  }
379  } break;
380  }
381  return {};
382 }
383 
384 uint32_t Type::GetNumChildren(bool omit_empty_base_classes) {
385  return GetForwardCompilerType().GetNumChildren(omit_empty_base_classes, nullptr);
386 }
387 
390 }
391 
392 lldb::TypeSP Type::GetTypedefType() {
393  lldb::TypeSP type_sp;
394  if (IsTypedef()) {
396  if (typedef_type)
397  type_sp = typedef_type->shared_from_this();
398  }
399  return type_sp;
400 }
401 
403 
405  // Make sure we resolve our type if it already hasn't been.
406  return GetForwardCompilerType().GetEncoding(count);
407 }
408 
410  lldb::addr_t address, AddressType address_type,
411  bool show_types, bool show_summary, bool verbose) {
412  if (address != LLDB_INVALID_ADDRESS) {
413  DataExtractor data;
414  Target *target = nullptr;
415  if (exe_ctx)
416  target = exe_ctx->GetTargetPtr();
417  if (target)
418  data.SetByteOrder(target->GetArchitecture().GetByteOrder());
419  if (ReadFromMemory(exe_ctx, address, address_type, data)) {
420  DumpValue(exe_ctx, s, data, 0, show_types, show_summary, verbose);
421  return true;
422  }
423  }
424  return false;
425 }
426 
428  AddressType address_type, DataExtractor &data) {
429  if (address_type == eAddressTypeFile) {
430  // Can't convert a file address to anything valid without more context
431  // (which Module it came from)
432  return false;
433  }
434 
435  const uint64_t byte_size =
436  GetByteSize(exe_ctx ? exe_ctx->GetBestExecutionContextScope() : nullptr)
437  .getValueOr(0);
438  if (data.GetByteSize() < byte_size) {
439  lldb::DataBufferSP data_sp(new DataBufferHeap(byte_size, '\0'));
440  data.SetData(data_sp);
441  }
442 
443  uint8_t *dst = const_cast<uint8_t *>(data.PeekData(0, byte_size));
444  if (dst != nullptr) {
445  if (address_type == eAddressTypeHost) {
446  // The address is an address in this process, so just copy it
447  if (addr == 0)
448  return false;
449  memcpy(dst, reinterpret_cast<uint8_t *>(addr), byte_size);
450  return true;
451  } else {
452  if (exe_ctx) {
453  Process *process = exe_ctx->GetProcessPtr();
454  if (process) {
455  Status error;
456  return exe_ctx->GetProcessPtr()->ReadMemory(addr, dst, byte_size,
457  error) == byte_size;
458  }
459  }
460  }
461  }
462  return false;
463 }
464 
466  AddressType address_type, DataExtractor &data) {
467  return false;
468 }
469 
470 const Declaration &Type::GetDeclaration() const { return m_decl; }
471 
472 bool Type::ResolveCompilerType(ResolveState compiler_type_resolve_state) {
473  // TODO: This needs to consider the correct type system to use.
474  Type *encoding_type = nullptr;
475  if (!m_compiler_type.IsValid()) {
476  encoding_type = GetEncodingType();
477  if (encoding_type) {
478  switch (m_encoding_uid_type) {
479  case eEncodingIsUID: {
480  CompilerType encoding_compiler_type =
481  encoding_type->GetForwardCompilerType();
482  if (encoding_compiler_type.IsValid()) {
483  m_compiler_type = encoding_compiler_type;
485  encoding_type->m_compiler_type_resolve_state;
486  }
487  } break;
488 
489  case eEncodingIsConstUID:
491  encoding_type->GetForwardCompilerType().AddConstModifier();
492  break;
493 
496  encoding_type->GetForwardCompilerType().AddRestrictModifier();
497  break;
498 
501  encoding_type->GetForwardCompilerType().AddVolatileModifier();
502  break;
503 
506  encoding_type->GetForwardCompilerType().GetAtomicType();
507  break;
508 
511  m_name.AsCString("__lldb_invalid_typedef_name"),
512  GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
513  m_name.Clear();
514  break;
515 
518  encoding_type->GetForwardCompilerType().GetPointerType();
519  break;
520 
524  break;
525 
529  break;
530 
531  default:
532  llvm_unreachable("Unhandled encoding_data_type.");
533  }
534  } else {
535  // We have no encoding type, return void?
536  auto type_system_or_err =
538  if (auto err = type_system_or_err.takeError()) {
539  LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
540  "Unable to construct void type from TypeSystemClang");
541  } else {
542  CompilerType void_compiler_type =
543  type_system_or_err->GetBasicTypeFromAST(eBasicTypeVoid);
544  switch (m_encoding_uid_type) {
545  case eEncodingIsUID:
546  m_compiler_type = void_compiler_type;
547  break;
548 
549  case eEncodingIsConstUID:
550  m_compiler_type = void_compiler_type.AddConstModifier();
551  break;
552 
554  m_compiler_type = void_compiler_type.AddRestrictModifier();
555  break;
556 
558  m_compiler_type = void_compiler_type.AddVolatileModifier();
559  break;
560 
562  m_compiler_type = void_compiler_type.GetAtomicType();
563  break;
564 
566  m_compiler_type = void_compiler_type.CreateTypedef(
567  m_name.AsCString("__lldb_invalid_typedef_name"),
568  GetSymbolFile()->GetDeclContextContainingUID(GetID()), m_payload);
569  break;
570 
572  m_compiler_type = void_compiler_type.GetPointerType();
573  break;
574 
576  m_compiler_type = void_compiler_type.GetLValueReferenceType();
577  break;
578 
580  m_compiler_type = void_compiler_type.GetRValueReferenceType();
581  break;
582 
583  default:
584  llvm_unreachable("Unhandled encoding_data_type.");
585  }
586  }
587  }
588 
589  // When we have a EncodingUID, our "m_flags.compiler_type_resolve_state" is
590  // set to eResolveStateUnresolved so we need to update it to say that we
591  // now have a forward declaration since that is what we created above.
592  if (m_compiler_type.IsValid())
594  }
595 
596  // Check if we have a forward reference to a class/struct/union/enum?
597  if (compiler_type_resolve_state == ResolveState::Layout ||
598  compiler_type_resolve_state == ResolveState::Full) {
599  // Check if we have a forward reference to a class/struct/union/enum?
600  if (m_compiler_type.IsValid() &&
601  m_compiler_type_resolve_state < compiler_type_resolve_state) {
603  if (!m_compiler_type.IsDefined()) {
604  // We have a forward declaration, we need to resolve it to a complete
605  // definition.
607  }
608  }
609  }
610 
611  // If we have an encoding type, then we need to make sure it is resolved
612  // appropriately.
614  if (encoding_type == nullptr)
615  encoding_type = GetEncodingType();
616  if (encoding_type) {
617  ResolveState encoding_compiler_type_resolve_state =
618  compiler_type_resolve_state;
619 
620  if (compiler_type_resolve_state == ResolveState::Layout) {
621  switch (m_encoding_uid_type) {
625  encoding_compiler_type_resolve_state = ResolveState::Forward;
626  break;
627  default:
628  break;
629  }
630  }
631  encoding_type->ResolveCompilerType(encoding_compiler_type_resolve_state);
632  }
633  }
634  return m_compiler_type.IsValid();
635 }
637  uint32_t encoding_mask = 1u << m_encoding_uid_type;
638  Type *encoding_type = GetEncodingType();
639  assert(encoding_type != this);
640  if (encoding_type)
641  encoding_mask |= encoding_type->GetEncodingMask();
642  return encoding_mask;
643 }
644 
647  return m_compiler_type;
648 }
649 
652  return m_compiler_type;
653 }
654 
657  return m_compiler_type;
658 }
659 
662 }
663 
664 bool Type::GetTypeScopeAndBasename(llvm::StringRef name,
665  llvm::StringRef &scope,
666  llvm::StringRef &basename,
667  TypeClass &type_class) {
668  type_class = eTypeClassAny;
669 
670  if (name.empty())
671  return false;
672 
673  basename = name;
674  if (basename.consume_front("struct "))
675  type_class = eTypeClassStruct;
676  else if (basename.consume_front("class "))
677  type_class = eTypeClassClass;
678  else if (basename.consume_front("union "))
679  type_class = eTypeClassUnion;
680  else if (basename.consume_front("enum "))
681  type_class = eTypeClassEnumeration;
682  else if (basename.consume_front("typedef "))
683  type_class = eTypeClassTypedef;
684 
685  size_t namespace_separator = basename.find("::");
686  if (namespace_separator == llvm::StringRef::npos)
687  return false;
688 
689  size_t template_begin = basename.find('<');
690  while (namespace_separator != llvm::StringRef::npos) {
691  if (template_begin != llvm::StringRef::npos &&
692  namespace_separator > template_begin) {
693  size_t template_depth = 1;
694  llvm::StringRef template_arg =
695  basename.drop_front(template_begin + 1);
696  while (template_depth > 0 && !template_arg.empty()) {
697  if (template_arg.front() == '<')
698  template_depth++;
699  else if (template_arg.front() == '>')
700  template_depth--;
701  template_arg = template_arg.drop_front(1);
702  }
703  if (template_depth != 0)
704  return false; // We have an invalid type name. Bail out.
705  if (template_arg.empty())
706  break; // The template ends at the end of the full name.
707  basename = template_arg;
708  } else {
709  basename = basename.drop_front(namespace_separator + 2);
710  }
711  template_begin = basename.find('<');
712  namespace_separator = basename.find("::");
713  }
714  if (basename.size() < name.size()) {
715  scope = name.take_front(name.size() - basename.size());
716  return true;
717  }
718  return false;
719 }
720 
721 ModuleSP Type::GetModule() {
722  if (m_symbol_file)
724  return ModuleSP();
725 }
726 
727 ModuleSP Type::GetExeModule() {
728  if (m_compiler_type) {
730  if (symbol_file)
731  return symbol_file->GetObjectFile()->GetModule();
732  }
733  return ModuleSP();
734 }
735 
736 TypeAndOrName::TypeAndOrName(TypeSP &in_type_sp) {
737  if (in_type_sp) {
738  m_compiler_type = in_type_sp->GetForwardCompilerType();
739  m_type_name = in_type_sp->GetName();
740  }
741 }
742 
743 TypeAndOrName::TypeAndOrName(const char *in_type_str)
744  : m_type_name(in_type_str) {}
745 
747  : m_type_name(in_type_const_string) {}
748 
749 bool TypeAndOrName::operator==(const TypeAndOrName &other) const {
750  if (m_compiler_type != other.m_compiler_type)
751  return false;
752  if (m_type_name != other.m_type_name)
753  return false;
754  return true;
755 }
756 
757 bool TypeAndOrName::operator!=(const TypeAndOrName &other) const {
758  return !(*this == other);
759 }
760 
762  if (m_type_name)
763  return m_type_name;
764  if (m_compiler_type)
765  return m_compiler_type.GetTypeName();
766  return ConstString("<invalid>");
767 }
768 
770  m_type_name = type_name;
771 }
772 
773 void TypeAndOrName::SetName(const char *type_name_cstr) {
774  m_type_name.SetCString(type_name_cstr);
775 }
776 
777 void TypeAndOrName::SetTypeSP(lldb::TypeSP type_sp) {
778  if (type_sp) {
779  m_compiler_type = type_sp->GetForwardCompilerType();
780  m_type_name = type_sp->GetName();
781  } else
782  Clear();
783 }
784 
786  m_compiler_type = compiler_type;
787  if (m_compiler_type)
789 }
790 
792  return !((bool)m_type_name || (bool)m_compiler_type);
793 }
794 
796  m_type_name.Clear();
798 }
799 
800 bool TypeAndOrName::HasName() const { return (bool)m_type_name; }
801 
803  return m_compiler_type.IsValid();
804 }
805 
806 TypeImpl::TypeImpl(const lldb::TypeSP &type_sp)
807  : m_module_wp(), m_static_type(), m_dynamic_type() {
808  SetType(type_sp);
809 }
810 
811 TypeImpl::TypeImpl(const CompilerType &compiler_type)
812  : m_module_wp(), m_static_type(), m_dynamic_type() {
813  SetType(compiler_type);
814 }
815 
816 TypeImpl::TypeImpl(const lldb::TypeSP &type_sp, const CompilerType &dynamic)
817  : m_module_wp(), m_static_type(), m_dynamic_type(dynamic) {
818  SetType(type_sp, dynamic);
819 }
820 
821 TypeImpl::TypeImpl(const CompilerType &static_type,
822  const CompilerType &dynamic_type)
823  : m_module_wp(), m_static_type(), m_dynamic_type() {
824  SetType(static_type, dynamic_type);
825 }
826 
827 void TypeImpl::SetType(const lldb::TypeSP &type_sp) {
828  if (type_sp) {
829  m_static_type = type_sp->GetForwardCompilerType();
830  m_exe_module_wp = type_sp->GetExeModule();
831  m_module_wp = type_sp->GetModule();
832  } else {
834  m_module_wp = lldb::ModuleWP();
835  }
836 }
837 
838 void TypeImpl::SetType(const CompilerType &compiler_type) {
839  m_module_wp = lldb::ModuleWP();
840  m_static_type = compiler_type;
841 }
842 
843 void TypeImpl::SetType(const lldb::TypeSP &type_sp,
844  const CompilerType &dynamic) {
845  SetType(type_sp);
846  m_dynamic_type = dynamic;
847 }
848 
849 void TypeImpl::SetType(const CompilerType &compiler_type,
850  const CompilerType &dynamic) {
851  m_module_wp = lldb::ModuleWP();
852  m_static_type = compiler_type;
853  m_dynamic_type = dynamic;
854 }
855 
856 bool TypeImpl::CheckModule(lldb::ModuleSP &module_sp) const {
857  return CheckModuleCommon(m_module_wp, module_sp);
858 }
859 
860 bool TypeImpl::CheckExeModule(lldb::ModuleSP &module_sp) const {
861  return CheckModuleCommon(m_exe_module_wp, module_sp);
862 }
863 
864 bool TypeImpl::CheckModuleCommon(const lldb::ModuleWP &input_module_wp,
865  lldb::ModuleSP &module_sp) const {
866  // Check if we have a module for this type. If we do and the shared pointer
867  // is can be successfully initialized with m_module_wp, return true. Else
868  // return false if we didn't have a module, or if we had a module and it has
869  // been deleted. Any functions doing anything with a TypeSP in this TypeImpl
870  // class should call this function and only do anything with the ivars if
871  // this function returns true. If we have a module, the "module_sp" will be
872  // filled in with a strong reference to the module so that the module will at
873  // least stay around long enough for the type query to succeed.
874  module_sp = input_module_wp.lock();
875  if (!module_sp) {
876  lldb::ModuleWP empty_module_wp;
877  // If either call to "std::weak_ptr::owner_before(...) value returns true,
878  // this indicates that m_module_wp once contained (possibly still does) a
879  // reference to a valid shared pointer. This helps us know if we had a
880  // valid reference to a section which is now invalid because the module it
881  // was in was deleted
882  if (empty_module_wp.owner_before(input_module_wp) ||
883  input_module_wp.owner_before(empty_module_wp)) {
884  // input_module_wp had a valid reference to a module, but all strong
885  // references have been released and the module has been deleted
886  return false;
887  }
888  }
889  // We either successfully locked the module, or didn't have one to begin with
890  return true;
891 }
892 
893 bool TypeImpl::operator==(const TypeImpl &rhs) const {
894  return m_static_type == rhs.m_static_type &&
896 }
897 
898 bool TypeImpl::operator!=(const TypeImpl &rhs) const {
899  return !(*this == rhs);
900 }
901 
902 bool TypeImpl::IsValid() const {
903  // just a name is not valid
904  ModuleSP module_sp;
905  if (CheckModule(module_sp))
907  return false;
908 }
909 
910 TypeImpl::operator bool() const { return IsValid(); }
911 
913  m_module_wp = lldb::ModuleWP();
916 }
917 
918 ModuleSP TypeImpl::GetModule() const {
919  lldb::ModuleSP module_sp;
920  if (CheckExeModule(module_sp))
921  return module_sp;
922  return nullptr;
923 }
924 
926  ModuleSP module_sp;
927  if (CheckModule(module_sp)) {
928  if (m_dynamic_type)
929  return m_dynamic_type.GetTypeName();
930  return m_static_type.GetTypeName();
931  }
932  return ConstString();
933 }
934 
936  ModuleSP module_sp;
937  if (CheckModule(module_sp)) {
938  if (m_dynamic_type)
941  }
942  return ConstString();
943 }
944 
946  ModuleSP module_sp;
947  if (CheckModule(module_sp)) {
948  if (m_dynamic_type.IsValid()) {
951  }
953  }
954  return TypeImpl();
955 }
956 
958  ModuleSP module_sp;
959  if (CheckModule(module_sp)) {
960  if (m_dynamic_type.IsValid()) {
963  }
965  }
966  return TypeImpl();
967 }
968 
970  ModuleSP module_sp;
971  if (CheckModule(module_sp)) {
972  if (m_dynamic_type.IsValid()) {
975  }
977  }
978  return TypeImpl();
979 }
980 
982  ModuleSP module_sp;
983  if (CheckModule(module_sp)) {
984  if (m_dynamic_type.IsValid()) {
987  }
989  }
990  return TypeImpl();
991 }
992 
994  ModuleSP module_sp;
995  if (CheckModule(module_sp)) {
996  if (m_dynamic_type.IsValid()) {
999  }
1001  }
1002  return TypeImpl();
1003 }
1004 
1006  ModuleSP module_sp;
1007  if (CheckModule(module_sp)) {
1008  if (m_dynamic_type.IsValid()) {
1011  }
1013  }
1014  return TypeImpl();
1015 }
1016 
1018  ModuleSP module_sp;
1019  if (CheckModule(module_sp)) {
1020  if (m_dynamic_type.IsValid()) {
1023  }
1025  }
1026  return TypeImpl();
1027 }
1028 
1030  ModuleSP module_sp;
1031  if (CheckModule(module_sp)) {
1032  if (prefer_dynamic) {
1033  if (m_dynamic_type.IsValid())
1034  return m_dynamic_type;
1035  }
1036  return m_static_type;
1037  }
1038  return CompilerType();
1039 }
1040 
1041 TypeSystem *TypeImpl::GetTypeSystem(bool prefer_dynamic) {
1042  ModuleSP module_sp;
1043  if (CheckModule(module_sp)) {
1044  if (prefer_dynamic) {
1045  if (m_dynamic_type.IsValid())
1046  return m_dynamic_type.GetTypeSystem();
1047  }
1048  return m_static_type.GetTypeSystem();
1049  }
1050  return nullptr;
1051 }
1052 
1054  lldb::DescriptionLevel description_level) {
1055  ModuleSP module_sp;
1056  if (CheckModule(module_sp)) {
1057  if (m_dynamic_type.IsValid()) {
1058  strm.Printf("Dynamic:\n");
1060  strm.Printf("\nStatic:\n");
1061  }
1063  } else {
1064  strm.PutCString("Invalid TypeImpl module for type has been deleted\n");
1065  }
1066  return true;
1067 }
1068 
1071 }
1072 
1074 
1076  return m_decl.GetMangledName();
1077 }
1078 
1080 
1082  return m_kind;
1083 }
1084 
1086  switch (m_kind) {
1088  return false;
1090  stream.Printf("constructor for %s",
1091  m_type.GetTypeName().AsCString("<unknown>"));
1092  break;
1094  stream.Printf("destructor for %s",
1095  m_type.GetTypeName().AsCString("<unknown>"));
1096  break;
1098  stream.Printf("instance method %s of type %s", m_name.AsCString(),
1100  break;
1102  stream.Printf("static method %s of type %s", m_name.AsCString(),
1104  break;
1105  }
1106  return true;
1107 }
1108 
1110  if (m_type)
1111  return m_type.GetFunctionReturnType();
1112  return m_decl.GetFunctionReturnType();
1113 }
1114 
1116  if (m_type)
1118  else
1120 }
1121 
1123  if (m_type)
1124  return m_type.GetFunctionArgumentAtIndex(idx);
1125  else
1126  return m_decl.GetFunctionArgumentType(idx);
1127 }
1128 
1129 TypeEnumMemberImpl::TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp,
1130  ConstString name,
1131  const llvm::APSInt &value)
1132  : m_integer_type_sp(integer_type_sp), m_name(name), m_value(value),
1133  m_valid((bool)name && (bool)integer_type_sp)
1134 
1135 {}
lldb_private::CompilerType::GetNonReferenceType
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...
Definition: CompilerType.cpp:394
lldb_private::TypeMemberFunctionImpl::m_kind
lldb::MemberFunctionKind m_kind
Definition: Type.h:472
lldb::eMemberFunctionKindDestructor
@ eMemberFunctionKindDestructor
A function used to tear down existing instances.
Definition: lldb-enumerations.h:1024
lldb_private::Stream::Format
void Format(const char *format, Args &&... args)
Definition: Stream.h:309
lldb_private::TypeMemberFunctionImpl::m_type
CompilerType m_type
Definition: Type.h:469
lldb_private::ObjectFile::GetArchitecture
virtual ArchSpec GetArchitecture()=0
Get the ArchSpec for this object file.
lldb_private::SymbolFile
Provides public interface for all SymbolFiles.
Definition: SymbolFile.h:45
lldb_private::TypeAndOrName::IsEmpty
bool IsEmpty() const
Definition: Type.cpp:791
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::ArchSpec::GetByteOrder
lldb::ByteOrder GetByteOrder() const
Returns the byte order for the architecture specification.
Definition: ArchSpec.cpp:731
lldb_private::Type::EncodingDataType
EncodingDataType
Definition: Type.h:68
Scalar.h
lldb_private::TypeImpl::CheckModuleCommon
bool CheckModuleCommon(const lldb::ModuleWP &input_module_wp, lldb::ModuleSP &module_sp) const
Definition: Type.cpp:864
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::TypeImpl::GetCanonicalType
TypeImpl GetCanonicalType() const
Definition: Type.cpp:1017
lldb_private::Type::DumpValue
void DumpValue(ExecutionContext *exe_ctx, Stream *s, const DataExtractor &data, uint32_t data_offset, bool show_type, bool show_summary, bool verbose, lldb::Format format=lldb::eFormatDefault)
Definition: Type.cpp:310
lldb_private::Type::eEncodingIsSyntheticUID
@ eEncodingIsSyntheticUID
This type is the synthetic type whose UID is m_encoding_uid.
Definition: Type.h:93
lldb_private::TypeImpl::operator==
bool operator==(const TypeImpl &rhs) const
Definition: Type.cpp:893
lldb_private::Process::ReadMemory
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:1921
lldb_private::LLDBLog::Symbols
@ Symbols
lldb::Format
Format
Display format definitions.
Definition: lldb-enumerations.h:155
lldb_private::Type::eEncodingIsConstUID
@ eEncodingIsConstUID
This type is the type whose UID is m_encoding_uid with the const qualifier added.
Definition: Type.h:75
lldb_private::CompilerType::IsDefined
bool IsDefined() const
Definition: CompilerType.cpp:201
lldb_private::CompilerDecl::GetNumFunctionArguments
size_t GetNumFunctionArguments() const
Definition: CompilerDecl.cpp:31
lldb_private::TypeAndOrName::SetName
void SetName(ConstString type_name)
Definition: Type.cpp:769
lldb_private::ExecutionContext::GetProcessPtr
Process * GetProcessPtr() const
Returns a pointer to the process object.
Definition: ExecutionContext.cpp:206
lldb_private::Type::GetFormat
lldb::Format GetFormat()
Definition: Type.cpp:402
lldb_private::Type::eEncodingIsTypedefUID
@ eEncodingIsTypedefUID
This type is alias to a type whose UID is m_encoding_uid.
Definition: Type.h:83
lldb_private::TypeAndOrName::HasName
bool HasName() const
Definition: Type.cpp:800
lldb_private::contextMatches
bool contextMatches(llvm::ArrayRef< CompilerContext > context_chain, llvm::ArrayRef< CompilerContext > pattern)
Match context_chain against pattern, which may contain "Any" kinds.
Definition: Type.cpp:37
lldb_private::TypeAndOrName::SetCompilerType
void SetCompilerType(CompilerType compiler_type)
Definition: Type.cpp:785
lldb_private::TypeImpl::CheckModule
bool CheckModule(lldb::ModuleSP &module_sp) const
Definition: Type.cpp:856
lldb_private::UserID
Definition: UserID.h:31
lldb_private::Type::GetEncodingType
Type * GetEncodingType()
Definition: Type.cpp:334
lldb_private::AddressType
AddressType
Definition: lldb-private-enumerations.h:30
lldb_private::Type::GetLayoutCompilerType
CompilerType GetLayoutCompilerType()
Definition: Type.cpp:650
lldb_private::TypeMemberFunctionImpl::m_decl
CompilerDecl m_decl
Definition: Type.h:470
lldb_private::Type::m_compiler_type_resolve_state
ResolveState m_compiler_type_resolve_state
Definition: Type.h:232
lldb_private::TypeImpl::GetModule
lldb::ModuleSP GetModule() const
Definition: Type.cpp:918
LLDB_INVALID_UID
#define LLDB_INVALID_UID
Definition: lldb-defines.h:80
lldb_private::Process
Definition: Process.h:338
lldb::eMemberFunctionKindUnknown
@ eMemberFunctionKindUnknown
Not sure what the type of this is.
Definition: lldb-enumerations.h:1022
Module.h
lldb_private::Type::m_payload
Payload m_payload
Language-specific flags.
Definition: Type.h:234
lldb_private::Type::GetModule
lldb::ModuleSP GetModule()
Since Type instances only keep a "SymbolFile *" internally, other classes like TypeImpl need make sur...
Definition: Type.cpp:721
lldb_private::eAddressTypeHost
@ eAddressTypeHost
Address is an address in the process that is running this code.
Definition: lldb-private-enumerations.h:36
lldb_private::Type::m_byte_size_has_value
uint64_t m_byte_size_has_value
Definition: Type.h:229
lldb_private::DataExtractor::PeekData
const uint8_t * PeekData(lldb::offset_t offset, lldb::offset_t length) const
Peek at a bytes at offset.
Definition: DataExtractor.h:832
lldb_private::TypeMemberFunctionImpl::GetMangledName
ConstString GetMangledName() const
Definition: Type.cpp:1075
lldb_private::ConstString::SetCString
void SetCString(const char *cstr)
Set the C string value.
Definition: ConstString.cpp:301
lldb_private::TypeImpl::GetDisplayTypeName
ConstString GetDisplayTypeName() const
Definition: Type.cpp:935
lldb_private::ConstString::AsCString
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
Definition: ConstString.h:193
lldb_private::SymbolFile::GetTypeSystemForLanguage
virtual llvm::Expected< lldb_private::TypeSystem & > GetTypeSystemForLanguage(lldb::LanguageType language)=0
lldb_private::CompilerType::GetOpaqueQualType
lldb::opaque_compiler_type_t GetOpaqueQualType() const
Definition: CompilerType.h:173
lldb_private::TypeMemberFunctionImpl::m_name
ConstString m_name
Definition: Type.h:471
lldb_private::CompilerType::AddVolatileModifier
CompilerType AddVolatileModifier() const
Return a new CompilerType adds a volatile modifier to this type if this type is valid and the type sy...
Definition: CompilerType.cpp:441
lldb_private::Type::m_encoding_uid_type
EncodingDataType m_encoding_uid_type
Definition: Type.h:227
lldb_private::Stream
Definition: Stream.h:28
lldb_private::Type::GetName
ConstString GetName()
Definition: Type.cpp:302
lldb_private::CompilerType::IsAggregateType
bool IsAggregateType() const
Definition: CompilerType.cpp:31
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::TypeAndOrName::Clear
void Clear()
Definition: Type.cpp:795
lldb_private::Target
Definition: Target.h:464
lldb_private::TypeList::ForEach
void ForEach(std::function< bool(const lldb::TypeSP &type_sp)> const &callback) const
Definition: TypeList.cpp:78
lldb_private::DataExtractor::SetData
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
Definition: DataExtractor.cpp:223
lldb_private::Type::Dump
void Dump(Stream *s, bool show_context, lldb::DescriptionLevel level=lldb::eDescriptionLevelFull)
Definition: Type.cpp:236
lldb_private::Type::GetEncoding
lldb::Encoding GetEncoding(uint64_t &count)
Definition: Type.cpp:404
lldb_private::Type::eEncodingIsRValueReferenceUID
@ eEncodingIsRValueReferenceUID
This type is R value reference to a type whose UID is m_encoding_uid.
Definition: Type.h:89
lldb_private::CompilerType::GetFunctionArgumentAtIndex
CompilerType GetFunctionArgumentAtIndex(const size_t index) const
Definition: CompilerType.cpp:122
Process.h
lldb_private::TypeImpl::TypeImpl
TypeImpl()=default
lldb_private::Type::ResolveCompilerType
bool ResolveCompilerType(ResolveState compiler_type_resolve_state)
Definition: Type.cpp:472
lldb_private::TypeImpl::IsValid
bool IsValid() const
Definition: Type.cpp:902
lldb_private::TypeImpl::m_dynamic_type
CompilerType m_dynamic_type
Definition: Type.h:312
Target.h
lldb_private::Type::Type
Type()
Definition: Type.cpp:164
lldb_private::TypeMemberFunctionImpl::GetName
ConstString GetName() const
Definition: Type.cpp:1073
lldb_private::DataExtractor::SetByteOrder
void SetByteOrder(lldb::ByteOrder byte_order)
Set the byte_order value.
Definition: DataExtractor.h:931
lldb_private::Type::GetByteSize
llvm::Optional< uint64_t > GetByteSize(ExecutionContextScope *exe_scope)
Definition: Type.cpp:340
lldb_private::Type::ResolveState
ResolveState
Definition: Type.h:96
lldb_private::Type::eEncodingInvalid
@ eEncodingInvalid
Invalid encoding.
Definition: Type.h:70
lldb_private::CompilerType::GetPointeeType
CompilerType GetPointeeType() const
If this type is a pointer type, return the type that the pointer points to, else return an invalid ty...
Definition: CompilerType.cpp:400
lldb_private::Declaration::Dump
void Dump(Stream *s, bool show_fullpaths) const
Dump a description of this object to a Stream.
Definition: Declaration.cpp:14
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::TypeMemberFunctionImpl::GetKind
lldb::MemberFunctionKind GetKind() const
Definition: Type.cpp:1081
lldb_private::CompilerContext
CompilerContext allows an array of these items to be passed to perform detailed lookups in SymbolVend...
Definition: Type.h:27
lldb_private::Type::m_symbol_file
SymbolFile * m_symbol_file
Definition: Type.h:222
lldb_private::SymbolFileType::GetType
Type * GetType()
Definition: Type.cpp:134
lldb_private::CompilerType::GetDisplayTypeName
ConstString GetDisplayTypeName() const
Definition: CompilerType.cpp:284
lldb_private::CompilerType::Clear
void Clear()
Definition: CompilerType.h:395
lldb_private::TypeAndOrName::GetName
ConstString GetName() const
Definition: Type.cpp:761
lldb_private::Stream::Indent
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
Definition: Stream.cpp:130
lldb_private::CompilerDecl::GetFunctionReturnType
CompilerType GetFunctionReturnType() const
Definition: CompilerDecl.cpp:27
lldb_private::SymbolFile::ResolveTypeUID
virtual Type * ResolveTypeUID(lldb::user_id_t type_uid)=0
lldb_private::Type::eEncodingIsRestrictUID
@ eEncodingIsRestrictUID
This type is the type whose UID is m_encoding_uid with the restrict qualifier added.
Definition: Type.h:78
lldb_private::DataExtractor
Definition: DataExtractor.h:48
Log.h
lldb_private::ExecutionContextScope
Definition: ExecutionContextScope.h:32
lldb_private::CompilerType::CreateTypedef
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...
Definition: CompilerType.cpp:455
lldb_private::TypeMemberFunctionImpl::GetType
CompilerType GetType() const
Definition: Type.cpp:1079
lldb_private::SymbolFileType::m_type_sp
lldb::TypeSP m_type_sp
Definition: Type.h:63
lldb_private::TypeAndOrName::HasCompilerType
bool HasCompilerType() const
Definition: Type.cpp:802
lldb_private::CompilerType::GetFormat
lldb::Format GetFormat() const
Definition: CompilerType.cpp:508
lldb_private::Type::eEncodingIsVolatileUID
@ eEncodingIsVolatileUID
This type is the type whose UID is m_encoding_uid with the volatile qualifier added.
Definition: Type.h:81
lldb_private::Type::GetTypedefType
lldb::TypeSP GetTypedefType()
Definition: Type.cpp:392
lldb_private::CompilerType::GetAtomicType
CompilerType GetAtomicType() const
Return a new CompilerType that is the atomic type of this type.
Definition: CompilerType.cpp:428
lldb_private::CompilerType::DumpValue
void DumpValue(ExecutionContext *exe_ctx, Stream *s, lldb::Format format, const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, bool show_types, bool show_summary, bool verbose, uint32_t depth)
Definition: CompilerType.cpp:723
StreamString.h
Type.h
SymbolContextScope.h
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::CompilerType::AddConstModifier
CompilerType AddConstModifier() const
Return a new CompilerType adds a const modifier to this type if this type is valid and the type syste...
Definition: CompilerType.cpp:434
lldb_private::CompilerType::GetNumberOfFunctionArguments
size_t GetNumberOfFunctionArguments() const
Definition: CompilerType.cpp:115
lldb_private::Type::DumpTypeName
void DumpTypeName(Stream *s)
Definition: Type.cpp:308
TypeAppendVisitor
Definition: Type.cpp:111
lldb_private::Type::GetExeModule
lldb::ModuleSP GetExeModule()
GetModule may return module for compile unit's object file.
Definition: Type.cpp:727
lldb_private::CompilerDecl::GetDeclContext
CompilerDeclContext GetDeclContext() const
Definition: CompilerDecl.cpp:23
lldb_private::Type::GetDeclaration
const lldb_private::Declaration & GetDeclaration() const
Definition: Type.cpp:470
lldb_private::Type::GetSymbolFile
SymbolFile * GetSymbolFile()
Definition: Type.h:133
TypeAppendVisitor::operator()
bool operator()(const lldb::TypeSP &type)
Definition: Type.cpp:115
lldb::eBasicTypeVoid
@ eBasicTypeVoid
Definition: lldb-enumerations.h:743
lldb_private::TypeImpl::GetPointeeType
TypeImpl GetPointeeType() const
Definition: Type.cpp:957
lldb_private::TypeImpl::GetDereferencedType
TypeImpl GetDereferencedType() const
Definition: Type.cpp:993
lldb_private::Type::WriteToMemory
bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition: Type.cpp:465
lldb_private::CompilerType::GetEncoding
lldb::Encoding GetEncoding(uint64_t &count) const
Definition: CompilerType.cpp:501
lldb_private::CompilerDeclContext::GetName
ConstString GetName() const
Definition: CompilerDeclContext.cpp:25
TypeSystem.h
lldb_private::Stream::PutChar
size_t PutChar(char ch)
Definition: Stream.cpp:104
lldb_private::CompilerType::GetFunctionReturnType
CompilerType GetFunctionReturnType() const
Definition: CompilerType.cpp:373
lldb_private::ConstString::Dump
void Dump(Stream *s, const char *value_if_empty=nullptr) const
Dump the object description to a stream.
Definition: ConstString.cpp:282
CompilerType.h
lldb_private::Type::ResolveState::Full
@ Full
lldb_private::CompilerType::IsValid
bool IsValid() const
Definition: CompilerType.h:72
lldb_private::CompilerType::GetLValueReferenceType
CompilerType GetLValueReferenceType() const
Return a new CompilerType that is a L value reference to this type if this type is valid and the type...
Definition: CompilerType.cpp:414
lldb_private::Type::m_context
SymbolContextScope * m_context
The symbol context in which this type is defined.
Definition: Type.h:224
lldb_private::SymbolContextScope
Definition: SymbolContextScope.h:64
ObjectFile.h
lldb_private::UserID::GetID
lldb::user_id_t GetID() const
Get accessor for the user ID.
Definition: UserID.h:47
lldb_private::CompilerType::GetNumChildren
uint32_t GetNumChildren(bool omit_empty_base_classes, const ExecutionContext *exe_ctx) const
Definition: CompilerType.cpp:515
lldb_private::Type::m_encoding_type
Type * m_encoding_type
Definition: Type.h:225
lldb_private::TypeImpl::GetName
ConstString GetName() const
Definition: Type.cpp:925
lldb_private::Type::GetEncodingMask
uint32_t GetEncodingMask()
Definition: Type.cpp:636
lldb_private::Type::eEncodingIsPointerUID
@ eEncodingIsPointerUID
This type is pointer to a type whose UID is m_encoding_uid.
Definition: Type.h:85
lldb_private::Type::GetDescription
void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name, ExecutionContextScope *exe_scope)
Definition: Type.cpp:171
TypeList.h
lldb_private::SymbolFile::CompleteType
virtual bool CompleteType(CompilerType &compiler_type)=0
lldb_private::ConstString::Clear
void Clear()
Clear this object's state.
Definition: ConstString.h:232
lldb_private::Type::m_encoding_uid
lldb::user_id_t m_encoding_uid
Definition: Type.h:226
TypeAppendVisitor::TypeAppendVisitor
TypeAppendVisitor(TypeListImpl &type_list)
Definition: Type.cpp:113
lldb_private::Target::GetArchitecture
const ArchSpec & GetArchitecture() const
Definition: Target.h:980
lldb_private::CompilerDecl::GetFunctionArgumentType
CompilerType GetFunctionArgumentType(size_t arg_idx) const
Definition: CompilerDecl.cpp:35
lldb::eMemberFunctionKindStaticMethod
@ eMemberFunctionKindStaticMethod
A function that applies to a type rather than any instance.
Definition: lldb-enumerations.h:1028
lldb_private::Status
Definition: Status.h:44
lldb_private::CompilerType::GetPointerType
CompilerType GetPointerType() const
Return a new CompilerType that is a pointer to this type.
Definition: CompilerType.cpp:407
lldb_private::Type::IsAggregateType
bool IsAggregateType()
Definition: Type.cpp:388
lldb_private::TypeImpl::GetUnqualifiedType
TypeImpl GetUnqualifiedType() const
Definition: Type.cpp:1005
lldb_private::Type::GetQualifiedName
ConstString GetQualifiedName()
Definition: Type.cpp:660
lldb_private::Type::ResolveState::Layout
@ Layout
uint32_t
lldb::eMemberFunctionKindConstructor
@ eMemberFunctionKindConstructor
A function used to create instances.
Definition: lldb-enumerations.h:1023
lldb_private::Type::eEncodingIsLValueReferenceUID
@ eEncodingIsLValueReferenceUID
This type is L value reference to a type whose UID is m_encoding_uid.
Definition: Type.h:87
lldb_private::ExecutionContext::GetBestExecutionContextScope
ExecutionContextScope * GetBestExecutionContextScope() const
Definition: ExecutionContext.cpp:214
lldb_private::TypeMemberFunctionImpl::GetArgumentAtIndex
CompilerType GetArgumentAtIndex(size_t idx) const
Definition: Type.cpp:1122
lldb_private::TypeMemberFunctionImpl::GetReturnType
CompilerType GetReturnType() const
Definition: Type.cpp:1109
lldb_private::Type::IsTypedef
bool IsTypedef()
Definition: Type.h:146
lldb_private::TypeImpl::SetType
void SetType(const lldb::TypeSP &type_sp)
Definition: Type.cpp:827
lldb_private::TypeAndOrName::SetTypeSP
void SetTypeSP(lldb::TypeSP type_sp)
Definition: Type.cpp:777
lldb_private::CompilerType::GetTypeSystem
TypeSystem * GetTypeSystem() const
Accessors.
Definition: CompilerType.h:162
lldb_private::Stream::EOL
size_t EOL()
Output and End of Line character to the stream.
Definition: Stream.cpp:128
lldb_private::TypeImpl::GetDescription
bool GetDescription(lldb_private::Stream &strm, lldb::DescriptionLevel description_level)
Definition: Type.cpp:1053
lldb_private::Type::ReadFromMemory
bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address, AddressType address_type, DataExtractor &data)
Definition: Type.cpp:427
lldb_private::CompilerType::GetTypeName
ConstString GetTypeName() const
Definition: CompilerType.cpp:277
lldb_private::TypeImpl::m_exe_module_wp
lldb::ModuleWP m_exe_module_wp
Definition: Type.h:310
lldb_private::eAddressTypeFile
@ eAddressTypeFile
Address is an address as found in an object or symbol file.
Definition: lldb-private-enumerations.h:32
lldb_private::Type::DumpValueInMemory
bool DumpValueInMemory(ExecutionContext *exe_ctx, Stream *s, lldb::addr_t address, AddressType address_type, bool show_types, bool show_summary, bool verbose)
Definition: Type.cpp:409
lldb_private::CompilerType::GetCanonicalType
CompilerType GetCanonicalType() const
Definition: CompilerType.cpp:341
lldb_private::Type
Definition: Type.h:66
lldb_private::TypeAndOrName::operator!=
bool operator!=(const TypeAndOrName &other) const
Definition: Type.cpp:757
lldb_private::TypeImpl::GetCompilerType
CompilerType GetCompilerType(bool prefer_dynamic)
Definition: Type.cpp:1029
lldb_private::Type::GetForwardCompilerType
CompilerType GetForwardCompilerType()
Definition: Type.cpp:655
lldb_private::ModuleChild::GetModule
lldb::ModuleSP GetModule() const
Get const accessor for the module pointer.
Definition: ModuleChild.cpp:24
lldb_private::CompilerType::AddRestrictModifier
CompilerType AddRestrictModifier() const
Return a new CompilerType adds a restrict modifier to this type if this type is valid and the type sy...
Definition: CompilerType.cpp:448
lldb_private::TypeAndOrName::operator==
bool operator==(const TypeAndOrName &other) const
Definition: Type.cpp:749
lldb_private::CompilerDecl::GetMangledName
ConstString GetMangledName() const
Definition: CompilerDecl.cpp:19
uint16_t
lldb_private::TypeImpl::Clear
void Clear()
Definition: Type.cpp:912
lldb_private::TypeImpl::GetTypeSystem
TypeSystem * GetTypeSystem(bool prefer_dynamic)
Definition: Type.cpp:1041
lldb::Encoding
Encoding
Register encoding definitions.
Definition: lldb-enumerations.h:146
LLDB_INVALID_ADDRESS
#define LLDB_INVALID_ADDRESS
Definition: lldb-defines.h:74
lldb_private::CompilerType::GetBasicTypeFromAST
CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const
Create related types using the current type's AST.
Definition: CompilerType.cpp:474
lldb_private::CompilerType::GetTypedefedType
CompilerType GetTypedefedType() const
If the current object represents a typedef type, get the underlying type.
Definition: CompilerType.cpp:464
DataExtractor.h
lldb_private::CompilerType
Generic representation of a type in a programming language.
Definition: CompilerType.h:33
lldb_private::Stream::Printf
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition: Stream.cpp:107
lldb_private::TypeMemberFunctionImpl::GetNumArguments
size_t GetNumArguments() const
Definition: Type.cpp:1115
lldb_private::Type::m_decl
Declaration m_decl
Definition: Type.h:230
lldb::user_id_t
uint64_t user_id_t
Definition: lldb-types.h:84
lldb::eLanguageTypeC
@ eLanguageTypeC
Non-standardized C, such as K&R.
Definition: lldb-enumerations.h:439
TypeAppendVisitor::m_type_list
TypeListImpl & m_type_list
Definition: Type.cpp:121
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::Type::ResolveState::Forward
@ Forward
lldb::eDescriptionLevelVerbose
@ eDescriptionLevelVerbose
Definition: lldb-enumerations.h:210
lldb_private::TypeImpl
Definition: Type.h:244
lldb_private::CompilerContext::kind
CompilerContextKind kind
Definition: Type.h:37
lldb_private::TypeImpl::GetPointerType
TypeImpl GetPointerType() const
Definition: Type.cpp:945
lldb_private::TypeSystem
Interface for representing a type system.
Definition: TypeSystem.h:71
lldb_private::TypeList
Definition: TypeList.h:20
lldb_private::TypeImpl::GetTypedefedType
TypeImpl GetTypedefedType() const
Definition: Type.cpp:981
lldb_private::SymbolContextScope::DumpSymbolContext
virtual void DumpSymbolContext(Stream *s)=0
Dump the object's symbol context to the stream s.
lldb_private::TypeAndOrName::TypeAndOrName
TypeAndOrName()=default
lldb::MemberFunctionKind
MemberFunctionKind
Kind of member function.
Definition: lldb-enumerations.h:1021
lldb_private::TypeImpl::GetReferenceType
TypeImpl GetReferenceType() const
Definition: Type.cpp:969
lldb_private::SymbolFileType::m_symbol_file
SymbolFile & m_symbol_file
Definition: Type.h:62
lldb_private::TypeImpl::m_module_wp
lldb::ModuleWP m_module_wp
Definition: Type.h:309
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb_private::Type::m_name
ConstString m_name
Definition: Type.h:221
lldb_private::TypeMemberFunctionImpl::IsValid
bool IsValid()
Definition: Type.cpp:1069
lldb_private::TypeSystem::GetSymbolFile
virtual SymbolFile * GetSymbolFile() const
Definition: TypeSystem.h:92
lldb_private::Type::eEncodingIsAtomicUID
@ eEncodingIsAtomicUID
This type is the type whose UID is m_encoding_uid as an atomic type.
Definition: Type.h:91
lldb_private::TypeAndOrName
Sometimes you can find the name of the type corresponding to an object, but we don't have debug infor...
Definition: Type.h:397
lldb_private::TypeImpl::CheckExeModule
bool CheckExeModule(lldb::ModuleSP &module_sp) const
Definition: Type.cpp:860
lldb::eMemberFunctionKindInstanceMethod
@ eMemberFunctionKindInstanceMethod
A function that applies to a specific instance.
Definition: lldb-enumerations.h:1026
SymbolVendor.h
lldb_private::GetLog
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
Definition: Log.h:235
lldb_private::SymbolFile::GetObjectFile
virtual ObjectFile * GetObjectFile()=0
lldb_private::TypeAndOrName::m_type_name
ConstString m_type_name
Definition: Type.h:435
lldb_private::TypeMemberFunctionImpl::GetDescription
bool GetDescription(Stream &stream)
Definition: Type.cpp:1085
lldb_private::Declaration
Definition: Declaration.h:24
lldb_private::DataExtractor::GetByteSize
uint64_t GetByteSize() const
Get the number of bytes contained in this object.
Definition: DataExtractor.h:270
lldb_private::Type::m_byte_size
uint64_t m_byte_size
Definition: Type.h:228
lldb_private::DataBufferHeap
Definition: DataBufferHeap.h:30
lldb_private::TypeImpl::operator!=
bool operator!=(const TypeImpl &rhs) const
Definition: Type.cpp:898
lldb
Definition: SBAddress.h:15
lldb_private::Type::m_compiler_type
CompilerType m_compiler_type
Definition: Type.h:231
LLDB_LOG_ERROR
#define LLDB_LOG_ERROR(log, error,...)
Definition: Log.h:286
lldb_private::Type::GetFullCompilerType
CompilerType GetFullCompilerType()
Definition: Type.cpp:645
LLDBLog.h
SymbolFile.h
lldb_private::TypeEnumMemberImpl::TypeEnumMemberImpl
TypeEnumMemberImpl()
Definition: Type.h:477
lldb::eFormatDefault
@ eFormatDefault
Definition: lldb-enumerations.h:156
lldb_private::ExecutionContext::GetTargetPtr
Target * GetTargetPtr() const
Returns a pointer to the target object.
Definition: ExecutionContext.cpp:198
ExecutionContext.h
lldb_private::CompilerType::GetRValueReferenceType
CompilerType GetRValueReferenceType() const
Return a new CompilerType that is a R value reference to this type if this type is valid and the type...
Definition: CompilerType.cpp:421
DataBufferHeap.h
lldb_private::CompilerType::GetFullyUnqualifiedType
CompilerType GetFullyUnqualifiedType() const
Definition: CompilerType.cpp:347
lldb_private::CompilerType::DumpTypeDescription
void DumpTypeDescription(lldb::DescriptionLevel level=lldb::eDescriptionLevelFull) const
Dump to stdout.
Definition: CompilerType.cpp:759
lldb_private::Type::eEncodingIsUID
@ eEncodingIsUID
This type is the type whose UID is m_encoding_uid.
Definition: Type.h:72
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb_private::TypeAndOrName::m_compiler_type
CompilerType m_compiler_type
Definition: Type.h:434
lldb_private::TypeListImpl
Definition: Type.h:315
lldb_private::TypeImpl::m_static_type
CompilerType m_static_type
Definition: Type.h:311
lldb_private::Type::GetNumChildren
uint32_t GetNumChildren(bool omit_empty_base_classes)
Definition: Type.cpp:384
lldb_private::Type::GetTypeScopeAndBasename
static bool GetTypeScopeAndBasename(llvm::StringRef name, llvm::StringRef &scope, llvm::StringRef &basename, lldb::TypeClass &type_class)
Definition: Type.cpp:664