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  /*expand_pack=*/true);
547  return 0;
548 }
549 
551  LLDB_INSTRUMENT_VA(this, idx);
552 
553  if (!IsValid())
554  return SBType();
555 
556  CompilerType type;
557  const bool expand_pack = true;
558  switch(GetTemplateArgumentKind(idx)) {
560  type = m_opaque_sp->GetCompilerType(false).GetTypeTemplateArgument(
561  idx, expand_pack);
562  break;
564  type = m_opaque_sp->GetCompilerType(false)
565  .GetIntegralTemplateArgument(idx, expand_pack)
566  ->type;
567  break;
568  default:
569  break;
570  }
571  if (type.IsValid())
572  return SBType(type);
573  return SBType();
574 }
575 
577  LLDB_INSTRUMENT_VA(this, idx);
578 
579  if (IsValid())
580  return m_opaque_sp->GetCompilerType(false).GetTemplateArgumentKind(
581  idx, /*expand_pack=*/true);
583 }
584 
585 SBTypeList::SBTypeList() : m_opaque_up(new TypeListImpl()) {
586  LLDB_INSTRUMENT_VA(this);
587 }
588 
590  : m_opaque_up(new TypeListImpl()) {
591  LLDB_INSTRUMENT_VA(this, rhs);
592 
593  for (uint32_t i = 0, rhs_size = const_cast<SBTypeList &>(rhs).GetSize();
594  i < rhs_size; i++)
595  Append(const_cast<SBTypeList &>(rhs).GetTypeAtIndex(i));
596 }
597 
599  LLDB_INSTRUMENT_VA(this);
600  return this->operator bool();
601 }
602 SBTypeList::operator bool() const {
603  LLDB_INSTRUMENT_VA(this);
604 
605  return (m_opaque_up != nullptr);
606 }
607 
609  LLDB_INSTRUMENT_VA(this, rhs);
610 
611  if (this != &rhs) {
612  m_opaque_up = std::make_unique<TypeListImpl>();
613  for (uint32_t i = 0, rhs_size = const_cast<SBTypeList &>(rhs).GetSize();
614  i < rhs_size; i++)
615  Append(const_cast<SBTypeList &>(rhs).GetTypeAtIndex(i));
616  }
617  return *this;
618 }
619 
621  LLDB_INSTRUMENT_VA(this, type);
622 
623  if (type.IsValid())
624  m_opaque_up->Append(type.m_opaque_sp);
625 }
626 
628  LLDB_INSTRUMENT_VA(this, index);
629 
630  if (m_opaque_up)
631  return SBType(m_opaque_up->GetTypeAtIndex(index));
632  return SBType();
633 }
634 
636  LLDB_INSTRUMENT_VA(this);
637 
638  return m_opaque_up->GetSize();
639 }
640 
641 SBTypeList::~SBTypeList() = default;
642 
644 
645 SBTypeMember::~SBTypeMember() = default;
646 
648  LLDB_INSTRUMENT_VA(this, rhs);
649 
650  if (this != &rhs) {
651  if (rhs.IsValid())
652  m_opaque_up = std::make_unique<TypeMemberImpl>(rhs.ref());
653  }
654 }
655 
657  LLDB_INSTRUMENT_VA(this, rhs);
658 
659  if (this != &rhs) {
660  if (rhs.IsValid())
661  m_opaque_up = std::make_unique<TypeMemberImpl>(rhs.ref());
662  }
663  return *this;
664 }
665 
666 bool SBTypeMember::IsValid() const {
667  LLDB_INSTRUMENT_VA(this);
668  return this->operator bool();
669 }
670 SBTypeMember::operator bool() const {
671  LLDB_INSTRUMENT_VA(this);
672 
673  return m_opaque_up.get();
674 }
675 
676 const char *SBTypeMember::GetName() {
677  LLDB_INSTRUMENT_VA(this);
678 
679  if (m_opaque_up)
680  return m_opaque_up->GetName().GetCString();
681  return nullptr;
682 }
683 
685  LLDB_INSTRUMENT_VA(this);
686 
687  SBType sb_type;
688  if (m_opaque_up) {
689  sb_type.SetSP(m_opaque_up->GetTypeImpl());
690  }
691  return sb_type;
692 }
693 
695  LLDB_INSTRUMENT_VA(this);
696 
697  if (m_opaque_up)
698  return m_opaque_up->GetBitOffset() / 8u;
699  return 0;
700 }
701 
703  LLDB_INSTRUMENT_VA(this);
704 
705  if (m_opaque_up)
706  return m_opaque_up->GetBitOffset();
707  return 0;
708 }
709 
711  LLDB_INSTRUMENT_VA(this);
712 
713  if (m_opaque_up)
714  return m_opaque_up->GetIsBitfield();
715  return false;
716 }
717 
719  LLDB_INSTRUMENT_VA(this);
720 
721  if (m_opaque_up)
722  return m_opaque_up->GetBitfieldBitSize();
723  return 0;
724 }
725 
727  lldb::DescriptionLevel description_level) {
728  LLDB_INSTRUMENT_VA(this, description, description_level);
729 
730  Stream &strm = description.ref();
731 
732  if (m_opaque_up) {
733  const uint32_t bit_offset = m_opaque_up->GetBitOffset();
734  const uint32_t byte_offset = bit_offset / 8u;
735  const uint32_t byte_bit_offset = bit_offset % 8u;
736  const char *name = m_opaque_up->GetName().GetCString();
737  if (byte_bit_offset)
738  strm.Printf("+%u + %u bits: (", byte_offset, byte_bit_offset);
739  else
740  strm.Printf("+%u: (", byte_offset);
741 
742  TypeImplSP type_impl_sp(m_opaque_up->GetTypeImpl());
743  if (type_impl_sp)
744  type_impl_sp->GetDescription(strm, description_level);
745 
746  strm.Printf(") %s", name);
747  if (m_opaque_up->GetIsBitfield()) {
748  const uint32_t bitfield_bit_size = m_opaque_up->GetBitfieldBitSize();
749  strm.Printf(" : %u", bitfield_bit_size);
750  }
751  } else {
752  strm.PutCString("No value");
753  }
754  return true;
755 }
756 
757 void SBTypeMember::reset(TypeMemberImpl *type_member_impl) {
758  m_opaque_up.reset(type_member_impl);
759 }
760 
762  if (m_opaque_up == nullptr)
763  m_opaque_up = std::make_unique<TypeMemberImpl>();
764  return *m_opaque_up;
765 }
766 
767 const TypeMemberImpl &SBTypeMember::ref() const { return *m_opaque_up; }
768 
770 
772 
774  : m_opaque_sp(rhs.m_opaque_sp) {
775  LLDB_INSTRUMENT_VA(this, rhs);
776 }
777 
780  LLDB_INSTRUMENT_VA(this, rhs);
781 
782  if (this != &rhs)
783  m_opaque_sp = rhs.m_opaque_sp;
784  return *this;
785 }
786 
788  LLDB_INSTRUMENT_VA(this);
789  return this->operator bool();
790 }
791 SBTypeMemberFunction::operator bool() const {
792  LLDB_INSTRUMENT_VA(this);
793 
794  return m_opaque_sp.get();
795 }
796 
798  LLDB_INSTRUMENT_VA(this);
799 
800  if (m_opaque_sp)
801  return m_opaque_sp->GetName().GetCString();
802  return nullptr;
803 }
804 
806  LLDB_INSTRUMENT_VA(this);
807 
808  if (m_opaque_sp) {
809  ConstString mangled_str = m_opaque_sp->GetMangledName();
810  if (mangled_str) {
811  Mangled mangled(mangled_str);
812  return mangled.GetDemangledName().GetCString();
813  }
814  }
815  return nullptr;
816 }
817 
819  LLDB_INSTRUMENT_VA(this);
820 
821  if (m_opaque_sp)
822  return m_opaque_sp->GetMangledName().GetCString();
823  return nullptr;
824 }
825 
827  LLDB_INSTRUMENT_VA(this);
828 
829  SBType sb_type;
830  if (m_opaque_sp) {
831  sb_type.SetSP(lldb::TypeImplSP(new TypeImpl(m_opaque_sp->GetType())));
832  }
833  return sb_type;
834 }
835 
837  LLDB_INSTRUMENT_VA(this);
838 
839  SBType sb_type;
840  if (m_opaque_sp) {
841  sb_type.SetSP(lldb::TypeImplSP(new TypeImpl(m_opaque_sp->GetReturnType())));
842  }
843  return sb_type;
844 }
845 
847  LLDB_INSTRUMENT_VA(this);
848 
849  if (m_opaque_sp)
850  return m_opaque_sp->GetNumArguments();
851  return 0;
852 }
853 
855  LLDB_INSTRUMENT_VA(this, i);
856 
857  SBType sb_type;
858  if (m_opaque_sp) {
859  sb_type.SetSP(
860  lldb::TypeImplSP(new TypeImpl(m_opaque_sp->GetArgumentAtIndex(i))));
861  }
862  return sb_type;
863 }
864 
866  LLDB_INSTRUMENT_VA(this);
867 
868  if (m_opaque_sp)
869  return m_opaque_sp->GetKind();
871 }
872 
874  lldb::SBStream &description, lldb::DescriptionLevel description_level) {
875  LLDB_INSTRUMENT_VA(this, description, description_level);
876 
877  Stream &strm = description.ref();
878 
879  if (m_opaque_sp)
880  return m_opaque_sp->GetDescription(strm);
881 
882  return false;
883 }
884 
886  m_opaque_sp.reset(type_member_impl);
887 }
888 
890  if (!m_opaque_sp)
891  m_opaque_sp = std::make_shared<TypeMemberFunctionImpl>();
892  return *m_opaque_sp.get();
893 }
894 
896  return *m_opaque_sp.get();
897 }
lldb::SBTypeMemberFunction::GetType
lldb::SBType GetType()
Definition: SBType.cpp:826
Instrumentation.h
lldb::SBType::GetTemplateArgumentKind
lldb::TemplateArgumentKind GetTemplateArgumentKind(uint32_t idx)
Return the TemplateArgumentKind of the template argument at index idx.
Definition: SBType.cpp:576
lldb::SBTypeList::GetTypeAtIndex
lldb::SBType GetTypeAtIndex(uint32_t index)
Definition: SBType.cpp:627
lldb::SBTypeMemberFunction::GetNumberOfArguments
uint32_t GetNumberOfArguments()
Definition: SBType.cpp:846
lldb_private::TypeMemberImpl
Definition: Type.h:346
lldb::SBTypeMemberFunction::operator=
lldb::SBTypeMemberFunction & operator=(const lldb::SBTypeMemberFunction &rhs)
Definition: SBType.cpp:779
lldb::SBStream::ref
lldb_private::Stream & ref()
Definition: SBStream.cpp:176
lldb::SBTypeList::operator=
lldb::SBTypeList & operator=(const lldb::SBTypeList &rhs)
Definition: SBType.cpp:608
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:227
lldb::SBTypeMember::GetName
const char * GetName()
Definition: SBType.cpp:676
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:748
lldb::SBType::GetMemberFunctionAtIndex
lldb::SBTypeMemberFunction GetMemberFunctionAtIndex(uint32_t idx)
Definition: SBType.cpp:319
lldb::SBTypeMember::GetBitfieldSizeInBits
uint32_t GetBitfieldSizeInBits()
Definition: SBType.cpp:718
lldb::SBTypeMember::operator=
lldb::SBTypeMember & operator=(const lldb::SBTypeMember &rhs)
Definition: SBType.cpp:656
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:1047
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:585
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:666
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:747
lldb::SBType::GetNumberOfTemplateArguments
uint32_t GetNumberOfTemplateArguments()
Definition: SBType.cpp:541
lldb::eTemplateArgumentKindType
@ eTemplateArgumentKindType
Definition: lldb-enumerations.h:823
lldb::SBType::GetNumberOfMemberFunctions
uint32_t GetNumberOfMemberFunctions()
Definition: SBType.cpp:310
lldb::SBTypeMemberFunction::GetArgumentTypeAtIndex
lldb::SBType GetArgumentTypeAtIndex(uint32_t)
Definition: SBType.cpp:854
lldb::SBType
class LLDB_API SBType
Definition: SBDefines.h:92
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:836
lldb::SBTypeMember::GetDescription
bool GetDescription(lldb::SBStream &description, lldb::DescriptionLevel description_level)
Definition: SBType.cpp:726
lldb::SBType::GetTemplateArgumentType
lldb::SBType GetTemplateArgumentType(uint32_t idx)
Definition: SBType.cpp:550
lldb::SBType::GetDereferencedType
lldb::SBType GetDereferencedType()
Definition: SBType.cpp:197
lldb::SBTypeMember::reset
void reset(lldb_private::TypeMemberImpl *)
Definition: SBType.cpp:757
SBStream.h
bool
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:684
lldb::SBModule::SetSP
void SetSP(const ModuleSP &module_sp)
Definition: SBModule.cpp:211
lldb::SBTypeMemberFunction::SBTypeMemberFunction
SBTypeMemberFunction()
Definition: SBType.cpp:769
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:39
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:598
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:821
CompilerType.h
lldb::SBTypeList::m_opaque_up
std::unique_ptr< lldb_private::TypeListImpl > m_opaque_up
Definition: SBType.h:266
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:635
lldb::SBType::IsFunctionType
bool IsFunctionType()
Definition: SBType.cpp:236
lldb::SBTypeList
Definition: SBType.h:245
lldb::SBTypeMemberFunction::GetName
const char * GetName()
Definition: SBType.cpp:797
lldb::SBTypeMemberFunction::ref
lldb_private::TypeMemberFunctionImpl & ref()
Definition: SBType.cpp:889
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:822
uint32_t
lldb::SBTypeMemberFunction::IsValid
bool IsValid() const
Definition: SBType.cpp:787
lldb::SBTypeMember::ref
lldb_private::TypeMemberImpl & ref()
Definition: SBType.cpp:761
lldb::SBType::SBType
SBType()
Definition: SBType.cpp:29
lldb::SBTypeMemberFunction::reset
void reset(lldb_private::TypeMemberFunctionImpl *)
Definition: SBType.cpp:885
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:710
lldb::SBTypeMemberFunction::GetKind
lldb::MemberFunctionKind GetKind()
Definition: SBType.cpp:865
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:1046
lldb::SBTypeList::Append
void Append(lldb::SBType type)
Definition: SBType.cpp:620
lldb::SBTypeMemberFunction::GetMangledName
const char * GetMangledName()
Definition: SBType.cpp:818
lldb::SBTypeMember::SBTypeMember
SBTypeMember()
Definition: SBType.cpp:643
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:825
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:873
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:702
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:694
lldb_private::TypeListImpl
Definition: Type.h:315
lldb::SBTypeMemberFunction::GetDemangledName
const char * GetDemangledName()
Definition: SBType.cpp:805