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