Skip to content

Commit 40e5157

Browse files
JDevlieghereadrian-prantl
authored andcommitted
[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. (cherry picked from commit f9632ce)
1 parent 6aeafdd commit 40e5157

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
@@ -768,7 +768,7 @@ class Target : public std::enable_shared_from_this<Target>,
768768
// Use this to create a breakpoint from a load address and a module file spec
769769
lldb::BreakpointSP CreateAddressInModuleBreakpoint(lldb::addr_t file_addr,
770770
bool internal,
771-
const FileSpec *file_spec,
771+
const FileSpec &file_spec,
772772
bool request_hardware);
773773

774774
// 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
@@ -608,8 +608,8 @@ class CommandObjectBreakpointSet : public CommandObjectParsed {
608608
// will track the load location of the library.
609609
size_t num_modules_specified = m_options.m_modules.GetSize();
610610
if (num_modules_specified == 1) {
611-
const FileSpec *file_spec =
612-
m_options.m_modules.GetFileSpecPointerAtIndex(0);
611+
const FileSpec &file_spec =
612+
m_options.m_modules.GetFileSpecAtIndex(0);
613613
bp_sp = target.CreateAddressInModuleBreakpoint(
614614
m_options.m_load_addr, internal, file_spec, m_options.m_hardware);
615615
} 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
@@ -465,12 +465,12 @@ BreakpointSP Target::CreateBreakpoint(const Address &addr, bool internal,
465465

466466
lldb::BreakpointSP
467467
Target::CreateAddressInModuleBreakpoint(lldb::addr_t file_addr, bool internal,
468-
const FileSpec *file_spec,
468+
const FileSpec &file_spec,
469469
bool request_hardware) {
470470
SearchFilterSP filter_sp(
471471
new SearchFilterForUnconstrainedSearches(shared_from_this()));
472472
BreakpointResolverSP resolver_sp(new BreakpointResolverAddress(
473-
nullptr, file_addr, file_spec ? *file_spec : FileSpec()));
473+
nullptr, file_addr, file_spec));
474474
return CreateBreakpoint(filter_sp, resolver_sp, internal, request_hardware,
475475
false);
476476
}

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)