From 92f6677159172fcab9daf5a0e761fd6b450a3f52 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Wed, 7 Jun 2017 16:28:08 +0000 Subject: [PATCH] Switch TaskMapOverInt to llvm::function_ref The function does not persist the callback, so using a lighter-weight asbtraction seems appropriate. Also tweak the signatures of the lambdas to match what the TaskMap interface expects. llvm-svn: 304924 --- lldb/include/lldb/Utility/TaskPool.h | 3 ++- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 5 ++--- lldb/source/Utility/TaskPool.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lldb/include/lldb/Utility/TaskPool.h b/lldb/include/lldb/Utility/TaskPool.h index 87b8824f9226..f2deaee506b8 100644 --- a/lldb/include/lldb/Utility/TaskPool.h +++ b/lldb/include/lldb/Utility/TaskPool.h @@ -10,6 +10,7 @@ #ifndef utility_TaskPool_h_ #define utility_TaskPool_h_ +#include "llvm/ADT/STLExtras.h" #include // for bind, function #include #include @@ -86,6 +87,6 @@ template <> struct TaskPool::RunTaskImpl<> { // 'batch_size' numbers at a time to work on, so for very fast functions, batch // should be large enough to avoid too much cache line contention. void TaskMapOverInt(size_t begin, size_t end, - std::function const &func); + const llvm::function_ref &func); #endif // #ifndef utility_TaskPool_h_ diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 279efe320a46..252a9807a3b5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1958,7 +1958,7 @@ void SymbolFileDWARF::Index() { &function_fullname_index, &function_method_index, &function_selector_index, &objc_class_selectors_index, &global_index, &type_index, - &namespace_index](uint32_t cu_idx) { + &namespace_index](size_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { dwarf_cu->Index( @@ -1967,10 +1967,9 @@ void SymbolFileDWARF::Index() { objc_class_selectors_index[cu_idx], global_index[cu_idx], type_index[cu_idx], namespace_index[cu_idx]); } - return cu_idx; }; - auto extract_fn = [debug_info, &clear_cu_dies](uint32_t cu_idx) { + auto extract_fn = [debug_info, &clear_cu_dies](size_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the diff --git a/lldb/source/Utility/TaskPool.cpp b/lldb/source/Utility/TaskPool.cpp index d8306dc7dc8f..d33f23cd861c 100644 --- a/lldb/source/Utility/TaskPool.cpp +++ b/lldb/source/Utility/TaskPool.cpp @@ -75,7 +75,7 @@ void TaskPoolImpl::Worker(TaskPoolImpl *pool) { } void TaskMapOverInt(size_t begin, size_t end, - std::function const &func) { + const llvm::function_ref &func) { std::atomic idx{begin}; size_t num_workers = std::min(end, std::thread::hardware_concurrency());