Author: labath Date: Wed Jun 7 11:28:08 2017 New Revision: 304924 URL: http://llvm.org/viewvc/llvm-project?rev=304924&view=rev Log: 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. Modified: lldb/trunk/include/lldb/Utility/TaskPool.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/trunk/source/Utility/TaskPool.cpp Modified: lldb/trunk/include/lldb/Utility/TaskPool.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TaskPool.h?rev=304924&r1=304923&r2=304924&view=diff ============================================================================== --- lldb/trunk/include/lldb/Utility/TaskPool.h (original) +++ lldb/trunk/include/lldb/Utility/TaskPool.h Wed Jun 7 11:28:08 2017 @@ -10,6 +10,7 @@ #ifndef utility_TaskPool_h_ #define utility_TaskPool_h_ +#include "llvm/ADT/STLExtras.h" #include <functional> // for bind, function #include <future> #include <list> @@ -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<void(size_t)> const &func); + const llvm::function_ref<void(size_t)> &func); #endif // #ifndef utility_TaskPool_h_ Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=304924&r1=304923&r2=304924&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed Jun 7 11:28:08 2017 @@ -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 Modified: lldb/trunk/source/Utility/TaskPool.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TaskPool.cpp?rev=304924&r1=304923&r2=304924&view=diff ============================================================================== --- lldb/trunk/source/Utility/TaskPool.cpp (original) +++ lldb/trunk/source/Utility/TaskPool.cpp Wed Jun 7 11:28:08 2017 @@ -75,7 +75,7 @@ void TaskPoolImpl::Worker(TaskPoolImpl * } void TaskMapOverInt(size_t begin, size_t end, - std::function<void(size_t)> const &func) { + const llvm::function_ref<void(size_t)> &func) { std::atomic<size_t> idx{begin}; size_t num_workers = std::min<size_t>(end, std::thread::hardware_concurrency()); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits