diff options
author | Johnny Chen <johnny.chen@apple.com> | 2012-03-16 20:46:10 +0000 |
---|---|---|
committer | Johnny Chen <johnny.chen@apple.com> | 2012-03-16 20:46:10 +0000 |
commit | 873a7a4b64353cd0e7b018abe19a2ea5a567e427 (patch) | |
tree | eaf2e7ff3565e051e0b6c72a697b9d3a42bcf095 /lldb/source/API/SBCompileUnit.cpp | |
parent | 531c085815e6e590c670e569f5d4f76917f3559d (diff) | |
download | bcm5719-llvm-873a7a4b64353cd0e7b018abe19a2ea5a567e427.tar.gz bcm5719-llvm-873a7a4b64353cd0e7b018abe19a2ea5a567e427.zip |
Patch from dawn@burble.org:
GetSupportFileAtIndex(), GetNumSupportFiles(), FindSupportFileIndex():
Add API support for getting the list of files in a compilation unit.
GetNumCompileUnits(), GetCompileUnitAtIndex():
Add API support for retrieving the compilation units in a module.
llvm-svn: 152942
Diffstat (limited to 'lldb/source/API/SBCompileUnit.cpp')
-rw-r--r-- | lldb/source/API/SBCompileUnit.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp index b1bb447753d..7852fc8a0d7 100644 --- a/lldb/source/API/SBCompileUnit.cpp +++ b/lldb/source/API/SBCompileUnit.cpp @@ -143,6 +143,52 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec return index; } +uint32_t +SBCompileUnit::GetNumSupportFiles () const +{ + if (m_opaque_ptr) + { + FileSpecList& support_files = m_opaque_ptr->GetSupportFiles (); + return support_files.GetSize(); + } + return 0; +} + +SBFileSpec +SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const +{ + LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); + + SBFileSpec sb_file_spec; + if (m_opaque_ptr) + { + FileSpecList &support_files = m_opaque_ptr->GetSupportFiles (); + FileSpec file_spec = support_files.GetFileSpecAtIndex(idx); + sb_file_spec.SetFileSpec(file_spec); + } + + if (log) + { + SBStream sstr; + sb_file_spec.GetDescription (sstr); + log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'", + m_opaque_ptr, idx, sb_file_spec.get(), sstr.GetData()); + } + + return sb_file_spec; +} + +uint32_t +SBCompileUnit::FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full) +{ + if (m_opaque_ptr) + { + FileSpecList &support_files = m_opaque_ptr->GetSupportFiles (); + return support_files.FindFileIndex(start_idx, sb_file.ref(), full); + } + return 0; +} + bool SBCompileUnit::IsValid () const { |