Skip to content

Commit 45d0e5d

Browse files
[lldb][NFC] Replace const std::vector& with ArrayRef in APIs
Inside the LLVM codebase, const vector& should just be ArrayRef, as this more general API works both with vectors, SmallVectors and SmallVectorImpl, as well as with single elements. This commit replaces two uses introduced in llvm#168797 .
1 parent ccfe7e0 commit 45d0e5d

File tree

4 files changed

+16
-43
lines changed

4 files changed

+16
-43
lines changed

lldb/include/lldb/Core/Module.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -298,29 +298,12 @@ class Module : public std::enable_shared_from_this<Module>,
298298
/// matches.
299299
void FindCompileUnits(const FileSpec &path, SymbolContextList &sc_list);
300300

301-
/// Find functions by lookup info.
302-
///
303-
/// If the function is an inlined function, it will have a block,
304-
/// representing the inlined function, and the function will be the
305-
/// containing function. If it is not inlined, then the block will be NULL.
306-
///
307-
/// \param[in] lookup_info
308-
/// The lookup info of the function we are looking for.
309-
///
310-
/// \param[out] sc_list
311-
/// A symbol context list that gets filled in with all of the
312-
/// matches.
313-
void FindFunctions(const LookupInfo &lookup_info,
314-
const CompilerDeclContext &parent_decl_ctx,
315-
const ModuleFunctionSearchOptions &options,
316-
SymbolContextList &sc_list);
317-
318301
/// Find functions by a vector of lookup infos.
319302
///
320303
/// If the function is an inlined function, it will have a block,
321304
/// representing the inlined function, and the function will be the
322305
/// containing function. If it is not inlined, then the block will be NULL.
323-
void FindFunctions(const std::vector<LookupInfo> &lookup_infos,
306+
void FindFunctions(llvm::ArrayRef<LookupInfo> lookup_infos,
324307
const CompilerDeclContext &parent_decl_ctx,
325308
const ModuleFunctionSearchOptions &options,
326309
SymbolContextList &sc_list);

lldb/include/lldb/Symbol/SymbolFile.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,9 @@ class SymbolFile : public PluginInterface {
309309
virtual void FindFunctions(const Module::LookupInfo &lookup_info,
310310
const CompilerDeclContext &parent_decl_ctx,
311311
bool include_inlines, SymbolContextList &sc_list);
312-
virtual void
313-
FindFunctions(const std::vector<Module::LookupInfo> &lookup_infos,
314-
const CompilerDeclContext &parent_decl_ctx,
315-
bool include_inlines, SymbolContextList &sc_list);
312+
virtual void FindFunctions(llvm::ArrayRef<Module::LookupInfo> lookup_infos,
313+
const CompilerDeclContext &parent_decl_ctx,
314+
bool include_inlines, SymbolContextList &sc_list);
316315
virtual void FindFunctions(const RegularExpression &regex,
317316
bool include_inlines, SymbolContextList &sc_list);
318317

lldb/source/Core/Module.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -820,33 +820,24 @@ void Module::LookupInfo::Prune(SymbolContextList &sc_list,
820820
}
821821
}
822822

823-
void Module::FindFunctions(const Module::LookupInfo &lookup_info,
823+
void Module::FindFunctions(llvm::ArrayRef<Module::LookupInfo> lookup_infos,
824824
const CompilerDeclContext &parent_decl_ctx,
825825
const ModuleFunctionSearchOptions &options,
826826
SymbolContextList &sc_list) {
827-
// Find all the functions (not symbols, but debug information functions...
828-
if (SymbolFile *symbols = GetSymbolFile()) {
827+
for (auto &lookup_info : lookup_infos) {
828+
SymbolFile *symbols = GetSymbolFile();
829+
if (!symbols)
830+
continue;
831+
829832
symbols->FindFunctions(lookup_info, parent_decl_ctx,
830833
options.include_inlines, sc_list);
831-
// Now check our symbol table for symbols that are code symbols if
832-
// requested
833-
if (options.include_symbols) {
834-
if (Symtab *symtab = symbols->GetSymtab()) {
834+
if (options.include_symbols)
835+
if (Symtab *symtab = symbols->GetSymtab())
835836
symtab->FindFunctionSymbols(lookup_info.GetLookupName(),
836837
lookup_info.GetNameTypeMask(), sc_list);
837-
}
838-
}
839838
}
840839
}
841840

842-
void Module::FindFunctions(const std::vector<Module::LookupInfo> &lookup_infos,
843-
const CompilerDeclContext &parent_decl_ctx,
844-
const ModuleFunctionSearchOptions &options,
845-
SymbolContextList &sc_list) {
846-
for (auto &lookup_info : lookup_infos)
847-
FindFunctions(lookup_info, parent_decl_ctx, options, sc_list);
848-
}
849-
850841
void Module::FindFunctions(ConstString name,
851842
const CompilerDeclContext &parent_decl_ctx,
852843
FunctionNameType name_type_mask,

lldb/source/Symbol/SymbolFile.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ void SymbolFile::FindFunctions(const Module::LookupInfo &lookup_info,
126126
bool include_inlines,
127127
SymbolContextList &sc_list) {}
128128

129-
void SymbolFile::FindFunctions(
130-
const std::vector<Module::LookupInfo> &lookup_infos,
131-
const CompilerDeclContext &parent_decl_ctx, bool include_inlines,
132-
SymbolContextList &sc_list) {
129+
void SymbolFile::FindFunctions(llvm::ArrayRef<Module::LookupInfo> lookup_infos,
130+
const CompilerDeclContext &parent_decl_ctx,
131+
bool include_inlines,
132+
SymbolContextList &sc_list) {
133133
for (const auto &lookup_info : lookup_infos)
134134
FindFunctions(lookup_info, parent_decl_ctx, include_inlines, sc_list);
135135
}

0 commit comments

Comments
 (0)