Skip to content

Commit f9632ce

Browse files
committed
[lldb] Remove FileSpecList::GetFileSpecPointerAtIndex (NFC)
There's only one use and it eventually converts the pointer into a reference. Simplify things and always use references.
1 parent 5109454 commit f9632ce

File tree

5 files changed

+5
-24
lines changed

5 files changed

+5
-24
lines changed

lldb/include/lldb/Target/Target.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ class Target : public std::enable_shared_from_this<Target>,
683683
// Use this to create a breakpoint from a load address and a module file spec
684684
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr,
685685
bool internal,
686-
const FileSpec *file_spec,
686+
const FileSpec &file_spec,
687687
bool request_hardware);
688688

689689
// Use this to create Address breakpoints:

lldb/include/lldb/Utility/FileSpecList.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,6 @@ class FileSpecList {
155155
/// returned.
156156
const FileSpec &GetFileSpecAtIndex(size_t idx) const;
157157

158-
/// Get file specification pointer at index.
159-
///
160-
/// Gets a file from the file list. The file objects that are returned can
161-
/// be tested using FileSpec::operator void*().
162-
///
163-
/// \param[in] idx
164-
/// An index into the file list.
165-
///
166-
/// \return
167-
/// A pointer to a contained FileSpec object at index \a idx.
168-
/// If \a idx is out of range, then an NULL is returned.
169-
const FileSpec *GetFileSpecPointerAtIndex(size_t idx) const;
170-
171158
/// Get the memory cost of this object.
172159
///
173160
/// Return the size in bytes that this object takes in memory. This returns

lldb/source/Commands/CommandObjectBreakpoint.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,8 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
603603
// will track the load location of the library.
604604
size_t num_modules_specified = m_options.m_modules.GetSize();
605605
if (num_modules_specified == 1) {
606-
const FileSpec *file_spec =
607-
m_options.m_modules.GetFileSpecPointerAtIndex(0);
606+
const FileSpec &file_spec =
607+
m_options.m_modules.GetFileSpecAtIndex(0);
608608
bp_sp = target.CreateAddressInModuleBreakpoint(
609609
m_options.m_load_addr, internal, file_spec, m_options.m_hardware);
610610
} else if (num_modules_specified == 0) {

lldb/source/Target/Target.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,12 @@ BreakpointSP Target::CreateBreakpoint(const Address &addr, bool internal,
480480

481481
lldb::BreakpointSP
482482
Target::CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal,
483-
const FileSpec *file_spec,
483+
const FileSpec &file_spec,
484484
bool request_hardware) {
485485
SearchFilterSP filter_sp(
486486
new SearchFilterForUnconstrainedSearches(shared_from_this()));
487487
BreakpointResolverSP resolver_sp(new BreakpointResolverAddress(
488-
nullptr, file_addr, file_spec ? *file_spec : FileSpec()));
488+
nullptr, file_addr, file_spec));
489489
return CreateBreakpoint(filter_sp, resolver_sp, internal, request_hardware,
490490
false);
491491
}

lldb/source/Utility/FileSpecList.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ const FileSpec &FileSpecList::GetFileSpecAtIndex(size_t idx) const {
140140
return g_empty_file_spec;
141141
}
142142

143-
const FileSpec *FileSpecList::GetFileSpecPointerAtIndex(size_t idx) const {
144-
if (idx < m_files.size())
145-
return &m_files[idx];
146-
return nullptr;
147-
}
148-
149143
// Return the size in bytes that this object takes in memory. This returns the
150144
// size in bytes of this object's member variables and any FileSpec objects its
151145
// member variables contain, the result doesn't not include the string values

0 commit comments

Comments
 (0)