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