LLDB  mainline
SBType.cpp
Go to the documentation of this file.
1 //===-- SBType.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 "lldb/API/SBType.h"
10 #include "lldb/API/SBDefines.h"
11 #include "lldb/API/SBModule.h"
12 #include "lldb/API/SBStream.h"
14 #include "lldb/Core/Mangled.h"
16 #include "lldb/Symbol/Type.h"
17 #include "lldb/Symbol/TypeSystem.h"
20 #include "lldb/Utility/Stream.h"
21 
22 #include "llvm/ADT/APSInt.h"
23 
24 #include <memory>
25 
26 using namespace lldb;
27 using namespace lldb_private;
28 
30 
32  : m_opaque_sp(new TypeImpl(
33  CompilerType(type.GetTypeSystem(), type.GetOpaqueQualType()))) {}
34 
35 SBType::SBType(const lldb::TypeSP &type_sp)
36  : m_opaque_sp(new TypeImpl(type_sp)) {}
37 
38 SBType::SBType(const lldb::TypeImplSP &type_impl_sp)
39  : m_opaque_sp(type_impl_sp) {}
40 
41 SBType::SBType(const SBType &rhs) {
42  LLDB_INSTRUMENT_VA(this, rhs);
43 
44  if (this != &rhs) {
46  }
47 }
48 
49 // SBType::SBType (TypeImpl* impl) :
50 // m_opaque_up(impl)
51 //{}
52 //
54  LLDB_INSTRUMENT_VA(this, rhs);
55 
56  if (!IsValid())
57  return !rhs.IsValid();
58 
59  if (!rhs.IsValid())
60  return false;
61 
62  return *m_opaque_sp.get() == *rhs.m_opaque_sp.get();
63 }
64 
66  LLDB_INSTRUMENT_VA(this, rhs);
67 
68  if (!IsValid())
69  return rhs.IsValid();
70 
71  if (!rhs.IsValid())
72  return true;
73 
74  return *m_opaque_sp.get() != *rhs.m_opaque_sp.get();
75 }
76 
77 lldb::TypeImplSP SBType::GetSP() { return m_opaque_sp; }
78 
79 void SBType::SetSP(const lldb::TypeImplSP &type_impl_sp) {
80  m_opaque_sp = type_impl_sp;
81 }
82 
84  LLDB_INSTRUMENT_VA(this, rhs);
85 
86  if (this != &rhs) {
88  }
89  return *this;
90 }
91 
92 SBType::~SBType() = default;
93 
95  if (m_opaque_sp.get() == nullptr)
96  m_opaque_sp = std::make_shared<TypeImpl>();
97  return *m_opaque_sp;
98 }
99 
100 const TypeImpl &SBType::ref() const {
101  // "const SBAddress &addr" should already have checked "addr.IsValid()" prior
102  // to calling this function. In case you didn't we will assert and die to let
103  // you know.
104  assert(m_opaque_sp.get());
105  return *m_opaque_sp;
106 }
107 
108 bool SBType::IsValid() const {
109  LLDB_INSTRUMENT_VA(this);
110  return this->operator bool();
111 }
112 SBType::operator bool() const {
113  LLDB_INSTRUMENT_VA(this);
114 
115  if (m_opaque_sp.get() == nullptr)
116  return false;
117 
118  return m_opaque_sp->IsValid();
119 }
120 
122  LLDB_INSTRUMENT_VA(this);
123 
124  if (IsValid())
125  if (llvm::Optional<uint64_t> size =
126  m_opaque_sp->GetCompilerType(false).GetByteSize(nullptr))
127  return *size;
128  return 0;
129 }
130 
132  LLDB_INSTRUMENT_VA(this);
133 
134  if (!IsValid())
135  return false;
136  return m_opaque_sp->GetCompilerType(true).IsPointerType();
137 }
138 
140  LLDB_INSTRUMENT_VA(this);
141 
142  if (!IsValid())
143  return false;
144  return m_opaque_sp->GetCompilerType(true).IsArrayType(nullptr, nullptr,
145  nullptr);
146 }
147 
149  LLDB_INSTRUMENT_VA(this);
150 
151  if (!IsValid())
152  return false;
153  return m_opaque_sp->GetCompilerType(true).IsVectorType(nullptr, nullptr);
154 }
155 
157  LLDB_INSTRUMENT_VA(this);
158 
159  if (!IsValid())
160  return false;
161  return m_opaque_sp->GetCompilerType(true).IsReferenceType();
162 }
163 
165  LLDB_INSTRUMENT_VA(this);
166 
167  if (!IsValid())
168  return SBType();
169 
170  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetPointerType())));
171 }
172 
174  LLDB_INSTRUMENT_VA(this);
175 
176  if (!IsValid())
177  return SBType();
178  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetPointeeType())));
179 }
180 
182  LLDB_INSTRUMENT_VA(this);
183 
184  if (!IsValid())
185  return SBType();
186  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetReferenceType())));
187 }
188 
190  LLDB_INSTRUMENT_VA(this);
191 
192  if (!IsValid())
193  return SBType();
194  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetTypedefedType())));
195 }
196 
198  LLDB_INSTRUMENT_VA(this);
199 
200  if (!IsValid())
201  return SBType();
202  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetDereferencedType())));
203 }
204 
206  LLDB_INSTRUMENT_VA(this);
207 
208  if (!IsValid())
209  return SBType();
210  return SBType(TypeImplSP(new TypeImpl(
211  m_opaque_sp->GetCompilerType(true).GetArrayElementType(nullptr))));
212 }
213 
214 SBType SBType::GetArrayType(uint64_t size) {
215  LLDB_INSTRUMENT_VA(this, size);
216 
217  if (!IsValid())
218  return SBType();
219  return SBType(TypeImplSP(
220  new TypeImpl(m_opaque_sp->GetCompilerType(true).GetArrayType(size))));
221 }
222 
224  LLDB_INSTRUMENT_VA(this);
225 
226  SBType type_sb;
227  if (IsValid()) {
228  CompilerType vector_element_type;
229  if (m_opaque_sp->GetCompilerType(true).IsVectorType(&vector_element_type,
230  nullptr))
231  type_sb.SetSP(TypeImplSP(new TypeImpl(vector_element_type)));
232  }
233  return type_sb;
234 }
235 
237  LLDB_INSTRUMENT_VA(this);
238 
239  if (!IsValid())
240  return false;
241  return m_opaque_sp->GetCompilerType(true).IsFunctionType();
242 }
243 
245  LLDB_INSTRUMENT_VA(this);
246 
247  if (!IsValid())
248  return false;
249  return m_opaque_sp->GetCompilerType(true).IsPolymorphicClass();
250 }
251 
253  LLDB_INSTRUMENT_VA(this);
254 
255  if (!IsValid())
256  return false;
257  return m_opaque_sp->GetCompilerType(true).IsTypedefType();
258 }
259 
261  LLDB_INSTRUMENT_VA(this);
262 
263  if (!IsValid())
264  return false;
265  return m_opaque_sp->GetCompilerType(true).IsAnonymousType();
266 }
267 
269  LLDB_INSTRUMENT_VA(this);
270 
271  if (!IsValid())
272  return false;
273  return m_opaque_sp->GetCompilerType(true).IsScopedEnumerationType();
274 }
275 
277  LLDB_INSTRUMENT_VA(this);
278 
279  if (!IsValid())
280  return false;
281  return m_opaque_sp->GetCompilerType(true).IsAggregateType();
282 }
283 
285  LLDB_INSTRUMENT_VA(this);
286 
287  if (IsValid()) {
288  CompilerType return_type(
289  m_opaque_sp->GetCompilerType(true).GetFunctionReturnType());
290  if (return_type.IsValid())
291  return SBType(return_type);
292  }
293  return lldb::SBType();
294 }
295 
297  LLDB_INSTRUMENT_VA(this);
298 
299  SBTypeList sb_type_list;
300  if (IsValid()) {
301  CompilerType func_type(m_opaque_sp->GetCompilerType(true));
302  size_t count = func_type.GetNumberOfFunctionArguments();
303  for (size_t i = 0; i < count; i++) {
304  sb_type_list.Append(SBType(func_type.GetFunctionArgumentAtIndex(i)));
305  }
306  }
307  return sb_type_list;
308 }
309 
311  LLDB_INSTRUMENT_VA(this);
312 
313  if (IsValid()) {
314  return m_opaque_sp->GetCompilerType(true).GetNumMemberFunctions();
315  }
316  return 0;
317 }
318 
320  LLDB_INSTRUMENT_VA(this, idx);
321 
322  SBTypeMemberFunction sb_func_type;
323  if (IsValid())
324  sb_func_type.reset(new TypeMemberFunctionImpl(
325  m_opaque_sp->GetCompilerType(true).GetMemberFunctionAtIndex(idx)));
326  return sb_func_type;
327 }
328 
330  LLDB_INSTRUMENT_VA(this);
331 
332  if (!IsValid())
333  return SBType();
334  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetUnqualifiedType())));
335 }
336 
338  LLDB_INSTRUMENT_VA(this);
339 
340  if (IsValid())
341  return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetCanonicalType())));
342  return SBType();
343 }
344 
346  LLDB_INSTRUMENT_VA(this);
347 
348  if (IsValid()) {
349  return SBType(
350  m_opaque_sp->GetCompilerType(true).GetEnumerationIntegerType());
351  }
352  return SBType();
353 }
354 
356  LLDB_INSTRUMENT_VA(this);
357 
358  if (IsValid())
359  return m_opaque_sp->GetCompilerType(false).GetBasicTypeEnumeration();
360  return eBasicTypeInvalid;
361 }
362 
364  LLDB_INSTRUMENT_VA(this, basic_type);
365 
366  if (IsValid() && m_opaque_sp->IsValid())
367  return SBType(
368  m_opaque_sp->GetTypeSystem(false)->GetBasicTypeFromAST(basic_type));
369  return SBType();
370 }
371 
373  LLDB_INSTRUMENT_VA(this);
374 
375  if (IsValid())
376  return m_opaque_sp->GetCompilerType(true).GetNumDirectBaseClasses();
377  return 0;
378 }
379 
381  LLDB_INSTRUMENT_VA(this);
382 
383  if (IsValid())
384  return m_opaque_sp->GetCompilerType(true).GetNumVirtualBaseClasses();
385  return 0;
386 }
387 
389  LLDB_INSTRUMENT_VA(this);
390 
391  if (IsValid())
392  return m_opaque_sp->GetCompilerType(true).GetNumFields();
393  return 0;
394 }
395 
397  lldb::DescriptionLevel description_level) {
398  LLDB_INSTRUMENT_VA(this, description, description_level);
399 
400  Stream &strm = description.ref();
401 
402  if (m_opaque_sp) {
403  m_opaque_sp->GetDescription(strm, description_level);
404  } else
405  strm.PutCString("No value");
406 
407  return true;
408 }
409 
411  LLDB_INSTRUMENT_VA(this, idx);
412 
413  SBTypeMember sb_type_member;
414  if (IsValid()) {
415  uint32_t bit_offset = 0;
416  CompilerType base_class_type =
417  m_opaque_sp->GetCompilerType(true).GetDirectBaseClassAtIndex(
418  idx, &bit_offset);
419  if (base_class_type.IsValid())
420  sb_type_member.reset(new TypeMemberImpl(
421  TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
422  }
423  return sb_type_member;
424 }
425 
427  LLDB_INSTRUMENT_VA(this, idx);
428 
429  SBTypeMember sb_type_member;
430  if (IsValid()) {
431  uint32_t bit_offset = 0;
432  CompilerType base_class_type =
433  m_opaque_sp->GetCompilerType(true).GetVirtualBaseClassAtIndex(
434  idx, &bit_offset);
435  if (base_class_type.IsValid())
436  sb_type_member.reset(new TypeMemberImpl(
437  TypeImplSP(new TypeImpl(base_class_type)), bit_offset));
438  }
439  return sb_type_member;
440 }
441 
443  LLDB_INSTRUMENT_VA(this);
444 
445  SBTypeEnumMemberList sb_enum_member_list;
446  if (IsValid()) {
447  CompilerType this_type(m_opaque_sp->GetCompilerType(true));
448  if (this_type.IsValid()) {
449  this_type.ForEachEnumerator([&sb_enum_member_list](
450  const CompilerType &integer_type,
451  ConstString name,
452  const llvm::APSInt &value) -> bool {
453  SBTypeEnumMember enum_member(
454  lldb::TypeEnumMemberImplSP(new TypeEnumMemberImpl(
455  lldb::TypeImplSP(new TypeImpl(integer_type)), name, value)));
456  sb_enum_member_list.Append(enum_member);
457  return true; // Keep iterating
458  });
459  }
460  }
461  return sb_enum_member_list;
462 }
463 
465  LLDB_INSTRUMENT_VA(this, idx);
466 
467  SBTypeMember sb_type_member;
468  if (IsValid()) {
469  CompilerType this_type(m_opaque_sp->GetCompilerType(false));
470  if (this_type.IsValid()) {
471  uint64_t bit_offset = 0;
472  uint32_t bitfield_bit_size = 0;
473  bool is_bitfield = false;
474  std::string name_sstr;
475  CompilerType field_type(this_type.GetFieldAtIndex(
476  idx, name_sstr, &bit_offset, &bitfield_bit_size, &is_bitfield));
477  if (field_type.IsValid()) {
478  ConstString name;
479  if (!name_sstr.empty())
480  name.SetCString(name_sstr.c_str());
481  sb_type_member.reset(
482  new TypeMemberImpl(TypeImplSP(new TypeImpl(field_type)), bit_offset,
483  name, bitfield_bit_size, is_bitfield));
484  }
485  }
486  }
487  return sb_type_member;
488 }
489 
491  LLDB_INSTRUMENT_VA(this);
492 
493  if (!IsValid())
494  return false;
495  return m_opaque_sp->GetCompilerType(false).IsCompleteType();
496 }
497 
499  LLDB_INSTRUMENT_VA(this);
500 
501  if (!IsValid())
502  return 0;
503  return m_opaque_sp->GetCompilerType(true).GetTypeInfo();
504 }
505 
507  LLDB_INSTRUMENT_VA(this);
508 
509  lldb::SBModule sb_module;
510  if (!IsValid())
511  return sb_module;
512 
513  sb_module.SetSP(m_opaque_sp->GetModule());
514  return sb_module;
515 }
516 
517 const char *SBType::GetName() {
518  LLDB_INSTRUMENT_VA(this);
519 
520  if (!IsValid())
521  return "";
522  return m_opaque_sp->GetName().GetCString();
523 }
524 
526  LLDB_INSTRUMENT_VA(this);
527 
528  if (!IsValid())
529  return "";
530  return m_opaque_sp->GetDisplayTypeName().GetCString();
531 }
532 
533 lldb::TypeClass SBType::GetTypeClass() {
534  LLDB_INSTRUMENT_VA(this);
535 
536  if (IsValid())
537  return m_opaque_sp->GetCompilerType(true).GetTypeClass();
538  return lldb::eTypeClassInvalid;
539 }
540 
542  LLDB_INSTRUMENT_VA(this);
543 
544  if (IsValid())
545  return m_opaque_sp->GetCompilerType(false).GetNumTemplateArguments();
546  return 0;
547 }
548 
550  LLDB_INSTRUMENT_VA(this, idx);
551 
552  if (!IsValid())
553  return SBType();
554 
555  CompilerType type;
556  switch(GetTemplateArgumentKind(idx)) {
558  type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument(idx);
559  break;
561  type = m_opaque_sp->GetCompilerType(false)
562  .GetIntegralTemplateArgument(idx)
563  ->type;
564  break;
565  default:
566  break;
567  }
568  if (type.IsValid())
569  return SBType(type);
570  return SBType();
571 }
572 
574  LLDB_INSTRUMENT_VA(this, idx);
575 
576  if (IsValid())
577  return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind(idx);
579 }
580 
581 SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) {
582  LLDB_INSTRUMENT_VA(this);
583 }
584 
586  : m_opaque_up(new TypeListImpl()) {
587  LLDB_INSTRUMENT_VA(this, rhs);
588 
589  for (uint32_t i = 0, rhs_size = const_cast<SBTypeList &>(rhs).GetSize();
590  i < rhs_size; i++)
591  Append(const_cast<SBTypeList &>(rhs).GetTypeAtIndex(i));
592 }
593 
595  LLDB_INSTRUMENT_VA(this);
596  return this->operator bool();
597 }
598 SBTypeList::operator bool() const {
599  LLDB_INSTRUMENT_VA(this);
600 
601  return (m_opaque_up != nullptr);
602 }
603 
605  LLDB_INSTRUMENT_VA(this, rhs);
606 
607  if (this != &rhs) {
608  m_opaque_up = std::make_unique<TypeListImpl>();
609  for (uint32_t i = 0, rhs_size = const_cast<SBTypeList &>(rhs).GetSize();
610  i < rhs_size; i++)
611  Append(const_cast<SBTypeList &>(rhs).GetTypeAtIndex(i));
612  }
613  return *this;
614 }
615 
617  LLDB_INSTRUMENT_VA(this, type);
618 
619  if (type.IsValid())
620  m_opaque_up->Append(type.m_opaque_sp);
621 }
622 
624  LLDB_INSTRUMENT_VA(this, index);
625 
626  if (m_opaque_up)
627  return SBType(m_opaque_up->GetTypeAtIndex(index));
628  return SBType();
629 }
630 
632  LLDB_INSTRUMENT_VA(this);
633 
634  return m_opaque_up->GetSize();
635 }
636 
637 SBTypeList::~SBTypeList() = default;
638 
640 
641 SBTypeMember::~SBTypeMember() = default;
642 
644  LLDB_INSTRUMENT_VA(this, rhs);
645 
646  if (this != &rhs) {
647  if (rhs.IsValid())
648  m_opaque_up = std::make_unique<TypeMemberImpl>(rhs.ref());
649  }
650 }
651 
653  LLDB_INSTRUMENT_VA(this, rhs);
654 
655  if (this != &rhs) {
656  if (rhs.IsValid())
657  m_opaque_up = std::make_unique<TypeMemberImpl>(rhs.ref());
658  }
659  return *this;
660 }
661 
662 bool SBTypeMember::IsValid() const {
663  LLDB_INSTRUMENT_VA(this);
664  return this->operator bool();
665 }
666 SBTypeMember::operator bool() const {
667  LLDB_INSTRUMENT_VA(this);
668 
669  return m_opaque_up.get();
670 }
671 
672 const char *SBTypeMember::GetName() {
673  LLDB_INSTRUMENT_VA(this);
674 
675  if (m_opaque_up)
676  return m_opaque_up->GetName().GetCString();
677  return nullptr;
678 }
679 
681  LLDB_INSTRUMENT_VA(this);
682 
683  SBType sb_type;
684  if (m_opaque_up) {
685  sb_type.SetSP(m_opaque_up->GetTypeImpl());
686  }
687  return sb_type;
688 }
689 
691  LLDB_INSTRUMENT_VA(this);
692 
693  if (m_opaque_up)
694  return m_opaque_up->GetBitOffset() / 8u;
695  return 0;
696 }
697 
699  LLDB_INSTRUMENT_VA(this);
700 
701  if (m_opaque_up)
702  return m_opaque_up->GetBitOffset();
703  return 0;
704 }
705 
707  LLDB_INSTRUMENT_VA(this);
708 
709  if (m_opaque_up)
710  return m_opaque_up->GetIsBitfield();
711  return false;
712 }
713 
715  LLDB_INSTRUMENT_VA(this);
716 
717  if (m_opaque_up)
718  return m_opaque_up->GetBitfieldBitSize();
719  return 0;
720 }
721 
723  lldb::DescriptionLevel description_level) {
724  LLDB_INSTRUMENT_VA(this, description, description_level);
725 
726  Stream &strm = description.ref();
727 
728  if (m_opaque_up) {
729  const uint32_t bit_offset = m_opaque_up->GetBitOffset();
730  const uint32_t byte_offset = bit_offset / 8u;
731  const uint32_t byte_bit_offset = bit_offset % 8u;
732  const char *name = m_opaque_up->GetName().GetCString();
733  if (byte_bit_offset)
734  strm.Printf("+%u + %u bits: (", byte_offset, byte_bit_offset);
735  else
736  strm.Printf("+%u: (", byte_offset);
737 
738  TypeImplSP type_impl_sp(m_opaque_up->GetTypeImpl());
739  if (type_impl_sp)
740  type_impl_sp->GetDescription(strm, description_level);
741 
742  strm.Printf(") %s", name);
743  if (m_opaque_up->GetIsBitfield()) {
744  const uint32_t bitfield_bit_size = m_opaque_up->GetBitfieldBitSize();
745  strm.Printf(" : %u", bitfield_bit_size);
746  }
747  } else {
748  strm.PutCString("No value");
749  }
750  return true;
751 }
752 
753 void SBTypeMember::reset(TypeMemberImpl *type_member_impl) {
754  m_opaque_up.reset(type_member_impl);
755 }
756 
758  if (m_opaque_up == nullptr)
759  m_opaque_up = std::make_unique<TypeMemberImpl>();
760  return *m_opaque_up;
761 }
762 
763 const TypeMemberImpl &SBTypeMember::ref() const { return *m_opaque_up; }
764 
766 
768 
770  : m_opaque_sp(rhs.m_opaque_sp) {
771  LLDB_INSTRUMENT_VA(this, rhs);
772 }
773 
776  LLDB_INSTRUMENT_VA(this, rhs);
777 
778  if (this != &rhs)
779  m_opaque_sp = rhs.m_opaque_sp;
780  return *this;
781 }
782 
784  LLDB_INSTRUMENT_VA(this);
785  return this->operator bool();
786 }
787 SBTypeMemberFunction::operator bool() const {
788  LLDB_INSTRUMENT_VA(this);
789 
790  return m_opaque_sp.get();
791 }
792 
794  LLDB_INSTRUMENT_VA(this);
795 
796  if (m_opaque_sp)
797  return m_opaque_sp->GetName().GetCString();
798  return nullptr;
799 }
800 
802  LLDB_INSTRUMENT_VA(this);
803 
804  if (m_opaque_sp) {
805  ConstString mangled_str = m_opaque_sp->GetMangledName();
806  if (mangled_str) {
807  Mangled mangled(mangled_str);
808  return mangled.GetDemangledName().GetCString();
809  }
810  }
811  return nullptr;
812 }
813 
815  LLDB_INSTRUMENT_VA(this);
816 
817  if (m_opaque_sp)
818  return m_opaque_sp->GetMangledName().GetCString();
819  return nullptr;
820 }
821 
823  LLDB_INSTRUMENT_VA(this);
824 
825  SBType sb_type;
826  if (m_opaque_sp) {
827  sb_type.SetSP(lldb::TypeImplSP(new TypeImpl(m_opaque_sp->GetType())));
828  }
829  return sb_type;
830 }
831 
833  LLDB_INSTRUMENT_VA(this);
834 
835  SBType sb_type;
836  if (m_opaque_sp) {
837  sb_type.SetSP(lldb::TypeImplSP(new TypeImpl(m_opaque_sp->GetReturnType())));
838  }
839  return sb_type;
840 }
841 
843  LLDB_INSTRUMENT_VA(this);
844 
845  if (m_opaque_sp)
846  return m_opaque_sp->GetNumArguments();
847  return 0;
848 }
849 
851  LLDB_INSTRUMENT_VA(this, i);
852 
853  SBType sb_type;
854  if (m_opaque_sp) {
855  sb_type.SetSP(
856  lldb::TypeImplSP(new TypeImpl(m_opaque_sp->GetArgumentAtIndex(i))));
857  }
858  return sb_type;
859 }
860 
862  LLDB_INSTRUMENT_VA(this);
863 
864  if (m_opaque_sp)
865  return m_opaque_sp->GetKind();
867 }
868 
870  lldb::SBStream &description, lldb::DescriptionLevel description_level) {
871  LLDB_INSTRUMENT_VA(this, description, description_level);
872 
873  Stream &strm = description.ref();
874 
875  if (m_opaque_sp)
876  return m_opaque_sp->GetDescription(strm);
877 
878  return false;
879 }
880 
882  m_opaque_sp.reset(type_member_impl);
883 }
884 
886  if (!m_opaque_sp)
887  m_opaque_sp = std::make_shared<TypeMemberFunctionImpl>();
888  return *m_opaque_sp.get();
889 }
890 
892  return *m_opaque_sp.get();
893 }
lldb::SBTypeMemberFunction::GetType
lldb::SBType GetType()
Definition: SBType.cpp:822
Instrumentation.h
lldb::SBType::GetTemplateArgumentKind
lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx)
Definition: SBType.cpp:573
lldb::SBTypeList::GetTypeAtIndex
lldb::SBType GetTypeAtIndex(uint32_t index)
Definition: SBType.cpp:623
lldb::SBTypeMemberFunction::GetNumberOfArguments
uint32_t GetNumberOfArguments()
Definition: SBType.cpp:842
lldb_private::TypeMemberImpl
Definition: Type.h:346
lldb::SBTypeMemberFunction::operator=
lldb::SBTypeMemberFunction & operator=(const lldb::SBTypeMemberFunction &rhs)
Definition: SBType.cpp:775
lldb::SBStream::ref
lldb_private::Stream & ref()
Definition: SBStream.cpp:176
lldb::SBTypeList::operator=
lldb::SBTypeList & operator=(const lldb::SBTypeList &rhs)
Definition: SBType.cpp:604
Mangled.h
lldb::SBType::GetReferenceType
lldb::SBType GetReferenceType()
Definition: SBType.cpp:181
lldb_private::TypeEnumMemberImpl
Definition: Type.h:475
lldb::SBType::GetFieldAtIndex
lldb::SBTypeMember GetFieldAtIndex(uint32_t idx)
Definition: SBType.cpp:464
lldb::SBType::IsVectorType
bool IsVectorType()
Definition: SBType.cpp:148
SBDefines.h
SBModule.h
lldb::SBType::operator==
bool operator==(lldb::SBType &rhs)
Definition: SBType.cpp:53
lldb::SBTypeEnumMemberList
Definition: SBTypeEnumMember.h:57
lldb::SBType::m_opaque_sp
lldb::TypeImplSP m_opaque_sp
Definition: SBType.h:225
lldb::SBTypeMember::GetName
const char * GetName()
Definition: SBType.cpp:672
lldb::SBType::operator=
lldb::SBType & operator=(const lldb::SBType &rhs)
Definition: SBType.cpp:83
lldb::SBType::GetNumberOfDirectBaseClasses
uint32_t GetNumberOfDirectBaseClasses()
Definition: SBType.cpp:372
lldb::eBasicTypeInvalid
@ eBasicTypeInvalid
Definition: lldb-enumerations.h:742
lldb::SBType::GetMemberFunctionAtIndex
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx)
Definition: SBType.cpp:319
lldb::SBTypeMember::GetBitfieldSizeInBits
uint32_t GetBitfieldSizeInBits()
Definition: SBType.cpp:714
lldb::SBTypeMember::operator=
lldb::SBTypeMember & operator=(const lldb::SBTypeMember &rhs)
Definition: SBType.cpp:652
lldb::SBType::GetVirtualBaseClassAtIndex
lldb::SBTypeMember GetVirtualBaseClassAtIndex(uint32_t idx)
Definition: SBType.cpp:426
lldb::eMemberFunctionKindUnknown
@ eMemberFunctionKindUnknown
Not sure what the type of this is.
Definition: lldb-enumerations.h:1022
lldb::SBTypeMember::m_opaque_up
std::unique_ptr< lldb_private::TypeMemberImpl > m_opaque_up
Definition: SBType.h:56
lldb::SBType::IsArrayType
bool IsArrayType()
Definition: SBType.cpp:139
lldb::SBTypeList::SBTypeList
SBTypeList()
Definition: SBType.cpp:581
lldb::SBType::IsTypeComplete
bool IsTypeComplete()
Definition: SBType.cpp:490
lldb_private::ConstString::SetCString
void SetCString(const char *cstr)
Set the C string value.
Definition: ConstString.cpp:301
lldb::SBTypeMember::~SBTypeMember
~SBTypeMember()
lldb::SBType::GetArrayType
lldb::SBType GetArrayType(uint64_t size)
Definition: SBType.cpp:214
lldb::SBTypeMember::IsValid
bool IsValid() const
Definition: SBType.cpp:662
lldb::SBTypeMemberFunction
Definition: SBType.h:59
SBTypeEnumMember.h
lldb_private::Stream
Definition: Stream.h:28
lldb::BasicType
BasicType
Basic types enumeration for the public API SBType::GetBasicType().
Definition: lldb-enumerations.h:741
lldb::SBType::GetNumberOfTemplateArguments
uint32_t GetNumberOfTemplateArguments()
Definition: SBType.cpp:541
lldb::eTemplateArgumentKindType
@ eTemplateArgumentKindType
Definition: lldb-enumerations.h:817
lldb::SBType::GetNumberOfMemberFunctions
uint32_t GetNumberOfMemberFunctions()
Definition: SBType.cpp:310
lldb::SBTypeMemberFunction::GetArgumentTypeAtIndex
lldb::SBType GetArgumentTypeAtIndex(uint32_t)
Definition: SBType.cpp:850
lldb::SBType
class LLDB_API SBType
Definition: SBDefines.h:91
lldb::SBType::IsAggregateType
bool IsAggregateType()
Definition: SBType.cpp:276
lldb_private::CompilerType::GetFunctionArgumentAtIndex
CompilerType GetFunctionArgumentAtIndex(const size_t index) const
Definition: CompilerType.cpp:122
lldb::SBTypeMemberFunction::GetReturnType
lldb::SBType GetReturnType()
Definition: SBType.cpp:832
lldb::SBTypeMember::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:722
lldb::SBType::GetTemplateArgumentType
lldb::SBType GetTemplateArgumentType(uint32_t idx)
Definition: SBType.cpp:549
lldb::SBType::GetDereferencedType
lldb::SBType GetDereferencedType()
Definition: SBType.cpp:197
lldb::SBTypeMember::reset
void reset(lldb_private::TypeMemberImpl *)
Definition: SBType.cpp:753
SBStream.h
lldb::SBType::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:396
lldb::SBTypeMember::GetType
lldb::SBType GetType()
Definition: SBType.cpp:680
lldb::SBModule::SetSP
void SetSP(const ModuleSP &module_sp)
Definition: SBModule.cpp:211
lldb::SBTypeMemberFunction::SBTypeMemberFunction
SBTypeMemberFunction()
Definition: SBType.cpp:765
lldb::SBType::GetPointeeType
lldb::SBType GetPointeeType()
Definition: SBType.cpp:173
lldb::SBType::GetTypeClass
lldb::TypeClass GetTypeClass()
Definition: SBType.cpp:533
Type.h
lldb::SBType::GetUnqualifiedType
lldb::SBType GetUnqualifiedType()
Definition: SBType.cpp:329
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::CompilerType::GetNumberOfFunctionArguments
size_t GetNumberOfFunctionArguments() const
Definition: CompilerType.cpp:115
lldb::SBType::GetModule
lldb::SBModule GetModule()
Definition: SBType.cpp:506
lldb::SBType::IsAnonymousType
bool IsAnonymousType()
Definition: SBType.cpp:260
lldb::SBType::GetFunctionArgumentTypes
lldb::SBTypeList GetFunctionArgumentTypes()
Definition: SBType.cpp:296
lldb::SBTypeList::IsValid
bool IsValid()
Definition: SBType.cpp:594
lldb::SBType::GetDisplayTypeName
const char * GetDisplayTypeName()
Definition: SBType.cpp:525
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
TypeSystem.h
lldb::SBType::GetNumberOfFields
uint32_t GetNumberOfFields()
Definition: SBType.cpp:388
lldb::SBType::operator!=
bool operator!=(lldb::SBType &rhs)
Definition: SBType.cpp:65
lldb::TemplateArgumentKind
TemplateArgumentKind
Definition: lldb-enumerations.h:815
CompilerType.h
lldb::SBTypeList::m_opaque_up
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
Definition: SBType.h:264
lldb_private::CompilerType::IsValid
bool IsValid() const
Definition: CompilerType.h:72
lldb::SBType
Definition: SBType.h:104
lldb::SBType::ref
lldb_private::TypeImpl & ref()
Definition: SBType.cpp:94
SBType.h
lldb::SBTypeList::GetSize
uint32_t GetSize()
Definition: SBType.cpp:631
lldb::SBType::IsFunctionType
bool IsFunctionType()
Definition: SBType.cpp:236
lldb::SBTypeList
Definition: SBType.h:243
lldb::SBTypeMemberFunction::GetName
const char * GetName()
Definition: SBType.cpp:793
lldb::SBTypeMemberFunction::ref
lldb_private::TypeMemberFunctionImpl & ref()
Definition: SBType.cpp:885
lldb::SBType::IsPointerType
bool IsPointerType()
Definition: SBType.cpp:131
lldb::SBTypeEnumMemberList::Append
void Append(SBTypeEnumMember entry)
Definition: SBTypeEnumMember.cpp:144
lldb::SBType::GetFunctionReturnType
lldb::SBType GetFunctionReturnType()
Definition: SBType.cpp:284
lldb::SBType::GetTypeFlags
uint32_t GetTypeFlags()
Definition: SBType.cpp:498
lldb::SBType::IsPolymorphicClass
bool IsPolymorphicClass()
Definition: SBType.cpp:244
lldb::eTemplateArgumentKindNull
@ eTemplateArgumentKindNull
Definition: lldb-enumerations.h:816
uint32_t
lldb::SBTypeMemberFunction::IsValid
bool IsValid() const
Definition: SBType.cpp:783
lldb::SBTypeMember::ref
lldb_private::TypeMemberImpl & ref()
Definition: SBType.cpp:757
lldb::SBType::SBType
SBType()
Definition: SBType.cpp:29
lldb::SBTypeMemberFunction::reset
void reset(lldb_private::TypeMemberFunctionImpl *)
Definition: SBType.cpp:881
lldb::SBType::GetPointerType
lldb::SBType GetPointerType()
Definition: SBType.cpp:164
lldb::SBModule
Definition: SBModule.h:20
lldb::SBTypeMemberFunction::~SBTypeMemberFunction
~SBTypeMemberFunction()
lldb::SBType::IsTypedefType
bool IsTypedefType()
Definition: SBType.cpp:252
lldb::SBType::GetSP
lldb::TypeImplSP GetSP()
Definition: SBType.cpp:77
lldb::SBTypeMember
Definition: SBType.h:18
lldb::SBTypeMember::IsBitfield
bool IsBitfield()
Definition: SBType.cpp:706
lldb::SBTypeMemberFunction::GetKind
lldb::MemberFunctionKind GetKind()
Definition: SBType.cpp:861
lldb::SBType::IsScopedEnumerationType
bool IsScopedEnumerationType()
Definition: SBType.cpp:268
lldb::SBType::GetNumberOfVirtualBaseClasses
uint32_t GetNumberOfVirtualBaseClasses()
Definition: SBType.cpp:380
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::SBType::GetTypedefedType
lldb::SBType GetTypedefedType()
Definition: SBType.cpp:189
lldb::SBType::GetName
const char * GetName()
Definition: SBType.cpp:517
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::TypeImpl
Definition: Type.h:244
lldb::SBType::GetEnumerationIntegerType
lldb::SBType GetEnumerationIntegerType()
Definition: SBType.cpp:345
lldb::SBTypeList::~SBTypeList
~SBTypeList()
LLDB_INSTRUMENT_VA
#define LLDB_INSTRUMENT_VA(...)
Definition: Instrumentation.h:98
lldb::SBType::GetCanonicalType
lldb::SBType GetCanonicalType()
Definition: SBType.cpp:337
ConstString.h
lldb::SBType::GetBasicType
lldb::BasicType GetBasicType()
Definition: SBType.cpp:355
lldb::SBType::GetArrayElementType
lldb::SBType GetArrayElementType()
Definition: SBType.cpp:205
lldb::MemberFunctionKind
MemberFunctionKind
Kind of member function.
Definition: lldb-enumerations.h:1021
lldb::SBTypeList::Append
void Append(lldb::SBType type)
Definition: SBType.cpp:616
lldb::SBTypeMemberFunction::GetMangledName
const char * GetMangledName()
Definition: SBType.cpp:814
lldb::SBTypeMember::SBTypeMember
SBTypeMember()
Definition: SBType.cpp:639
Stream.h
lldb_private::CompilerType::GetFieldAtIndex
CompilerType GetFieldAtIndex(size_t idx, std::string &name, uint64_t *bit_offset_ptr, uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) const
Definition: CompilerType.cpp:543
lldb_private::Stream::PutCString
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition: Stream.cpp:63
lldb::SBType::IsValid
bool IsValid() const
Definition: SBType.cpp:108
lldb::eTemplateArgumentKindIntegral
@ eTemplateArgumentKindIntegral
Definition: lldb-enumerations.h:819
lldb::SBType::GetEnumMembers
lldb::SBTypeEnumMemberList GetEnumMembers()
Definition: SBType.cpp:442
lldb::SBStream
Definition: SBStream.h:18
lldb::SBType::GetDirectBaseClassAtIndex
lldb::SBTypeMember GetDirectBaseClassAtIndex(uint32_t idx)
Definition: SBType.cpp:410
lldb_private::TypeMemberFunctionImpl
Definition: Type.h:438
lldb::SBType::GetVectorElementType
lldb::SBType GetVectorElementType()
Definition: SBType.cpp:223
lldb::SBType::GetByteSize
uint64_t GetByteSize()
Definition: SBType.cpp:121
lldb::SBType::IsReferenceType
bool IsReferenceType()
Definition: SBType.cpp:156
lldb::SBTypeMemberFunction::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:869
lldb_private::CompilerType::ForEachEnumerator
void ForEachEnumerator(std::function< bool(const CompilerType &integer_type, ConstString name, const llvm::APSInt &value)> const &callback) const
If this type is an enumeration, iterate through all of its enumerators using a callback.
Definition: CompilerType.cpp:529
lldb::SBTypeMemberFunction::m_opaque_sp
lldb::TypeMemberFunctionImplSP m_opaque_sp
Definition: SBType.h:101
lldb
Definition: SBAddress.h:15
lldb::SBType::SetSP
void SetSP(const lldb::TypeImplSP &type_impl_sp)
Definition: SBType.cpp:79
lldb::SBTypeMember::GetOffsetInBits
uint64_t GetOffsetInBits()
Definition: SBType.cpp:698
lldb::SBTypeEnumMember
Definition: SBTypeEnumMember.h:17
lldb::SBType::~SBType
~SBType()
lldb::DescriptionLevel
DescriptionLevel
Description levels for "void GetDescription(Stream *, DescriptionLevel)" calls.
Definition: lldb-enumerations.h:207
lldb::SBTypeMember::GetOffsetInBytes
uint64_t GetOffsetInBytes()
Definition: SBType.cpp:690
lldb_private::TypeListImpl
Definition: Type.h:315
lldb::SBTypeMemberFunction::GetDemangledName
const char * GetDemangledName()
Definition: SBType.cpp:801