SBBlock.cpp revision 69aa5d9a7620a183cdc4da12cc87ea82e2ffcbf9
1//===-- SBBlock.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/SBBlock.h" 11#include "lldb/API/SBFileSpec.h" 12#include "lldb/Symbol/Block.h" 13#include "lldb/Symbol/Function.h" 14 15using namespace lldb; 16using namespace lldb_private; 17 18 19SBBlock::SBBlock () : 20 m_opaque_ptr (NULL) 21{ 22} 23 24SBBlock::SBBlock (lldb_private::Block *lldb_object_ptr) : 25 m_opaque_ptr (lldb_object_ptr) 26{ 27} 28 29SBBlock::~SBBlock () 30{ 31 m_opaque_ptr = NULL; 32} 33 34bool 35SBBlock::IsValid () const 36{ 37 return m_opaque_ptr != NULL; 38} 39 40bool 41SBBlock::IsInlined () const 42{ 43 if (m_opaque_ptr) 44 return m_opaque_ptr->GetInlinedFunctionInfo () != NULL; 45 return false; 46} 47 48const char * 49SBBlock::GetInlinedName () const 50{ 51 if (m_opaque_ptr) 52 { 53 const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo (); 54 if (inlined_info) 55 return inlined_info->GetName().AsCString (NULL); 56 } 57 return NULL; 58} 59 60SBFileSpec 61SBBlock::GetInlinedCallSiteFile () const 62{ 63 SBFileSpec sb_file; 64 if (m_opaque_ptr) 65 { 66 const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo (); 67 if (inlined_info) 68 sb_file.SetFileSpec (inlined_info->GetCallSite().GetFile()); 69 } 70 return sb_file; 71} 72 73uint32_t 74SBBlock::GetInlinedCallSiteLine () const 75{ 76 if (m_opaque_ptr) 77 { 78 const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo (); 79 if (inlined_info) 80 return inlined_info->GetCallSite().GetLine(); 81 } 82 return 0; 83} 84 85uint32_t 86SBBlock::GetInlinedCallSiteColumn () const 87{ 88 if (m_opaque_ptr) 89 { 90 const InlineFunctionInfo* inlined_info = m_opaque_ptr->GetInlinedFunctionInfo (); 91 if (inlined_info) 92 return inlined_info->GetCallSite().GetColumn(); 93 } 94 return 0; 95} 96 97void 98SBBlock::AppendVariables (bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list) 99{ 100 if (IsValid()) 101 { 102 bool show_inline = true; 103 m_opaque_ptr->AppendVariables (can_create, get_parent_variables, show_inline, var_list); 104 } 105} 106 107SBBlock 108SBBlock::GetParent () 109{ 110 SBBlock sb_block; 111 if (m_opaque_ptr) 112 sb_block.m_opaque_ptr = m_opaque_ptr->GetParent(); 113 return sb_block; 114} 115 116SBBlock 117SBBlock::GetSibling () 118{ 119 SBBlock sb_block; 120 if (m_opaque_ptr) 121 sb_block.m_opaque_ptr = m_opaque_ptr->GetSibling(); 122 return sb_block; 123} 124 125SBBlock 126SBBlock::GetFirstChild () 127{ 128 SBBlock sb_block; 129 if (m_opaque_ptr) 130 sb_block.m_opaque_ptr = m_opaque_ptr->GetFirstChild(); 131 return sb_block; 132} 133 134 135 136