diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2021-08-05 09:27:19 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2021-08-05 10:18:14 -0700 |
commit | c020be17ce0a43c32554585e1075627769f364f3 (patch) | |
tree | 46dd8c71d4a2823f6aee0e3f6f2816ce7097e06d /lldb/source/Commands/CommandObjectSource.cpp | |
parent | a756239e727842f2c274208acd8fb93fa745d04a (diff) | |
download | llvm-c020be17ce0a43c32554585e1075627769f364f3.zip llvm-c020be17ce0a43c32554585e1075627769f364f3.tar.gz llvm-c020be17ce0a43c32554585e1075627769f364f3.tar.bz2 |
[lldb] Use a struct to pass function search options to Module::FindFunction
Rather than passing two booleans around, which is especially error prone
with them being next to each other, use a struct with named fields
instead.
Differential revision: https://reviews.llvm.org/D107295
Diffstat (limited to 'lldb/source/Commands/CommandObjectSource.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectSource.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 7a0338e..fb33f41 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -374,13 +374,16 @@ protected: Target *target = m_exe_ctx.GetTargetPtr(); uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize(); + ModuleFunctionSearchOptions function_options; + function_options.include_symbols = false; + function_options.include_inlines = true; + // Note: module_list can't be const& because FindFunctionSymbols isn't // const. ModuleList module_list = (m_module_list.GetSize() > 0) ? m_module_list : target->GetImages(); - module_list.FindFunctions(name, eFunctionNameTypeAuto, - /*include_symbols=*/false, - /*include_inlines=*/true, sc_list_funcs); + module_list.FindFunctions(name, eFunctionNameTypeAuto, function_options, + sc_list_funcs); size_t num_matches = sc_list_funcs.GetSize(); if (!num_matches) { @@ -874,12 +877,13 @@ protected: void FindMatchingFunctions(Target *target, ConstString name, SymbolContextList &sc_list) { // Displaying the source for a symbol: - bool include_inlines = true; - bool include_symbols = false; - if (m_options.num_lines == 0) m_options.num_lines = 10; + ModuleFunctionSearchOptions function_options; + function_options.include_symbols = true; + function_options.include_inlines = false; + const size_t num_modules = m_options.modules.size(); if (num_modules > 0) { ModuleList matching_modules; @@ -889,15 +893,14 @@ protected: ModuleSpec module_spec(module_file_spec); matching_modules.Clear(); target->GetImages().FindModules(module_spec, matching_modules); + matching_modules.FindFunctions(name, eFunctionNameTypeAuto, - include_symbols, include_inlines, - sc_list); + function_options, sc_list); } } } else { target->GetImages().FindFunctions(name, eFunctionNameTypeAuto, - include_symbols, include_inlines, - sc_list); + function_options, sc_list); } } |