[Lldb-commits] [lldb] r366489 - [FileSpecList] Add EmplaceBack method (NFC)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Jul 18 13:19:25 PDT 2019
Author: jdevlieghere
Date: Thu Jul 18 13:19:24 2019
New Revision: 366489
URL: http://llvm.org/viewvc/llvm-project?rev=366489&view=rev
Log:
[FileSpecList] Add EmplaceBack method (NFC)
Instead of having to write FileSpecList::Append(FileSpec(args)) you can
now call FileSpecList::EmplaceBack(args), similar to
std::vector<>::emplace_back.
Modified:
lldb/trunk/include/lldb/Core/FileSpecList.h
lldb/trunk/source/Core/SearchFilter.cpp
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/include/lldb/Core/FileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FileSpecList.h?rev=366489&r1=366488&r2=366489&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FileSpecList.h (original)
+++ lldb/trunk/include/lldb/Core/FileSpecList.h Thu Jul 18 13:19:24 2019
@@ -76,6 +76,15 @@ public:
/// \b true if the file was appended, \b false otherwise.
bool AppendIfUnique(const FileSpec &file);
+ /// Inserts a new FileSpec into the FileSpecList constructed in-place with
+ /// the given arguments.
+ ///
+ /// \param[in] args
+ /// Arguments to create the FileSpec
+ template <class... Args> void EmplaceBack(Args &&... args) {
+ m_files.emplace_back(std::forward<Args>(args)...);
+ }
+
/// Clears the file list.
void Clear();
Modified: lldb/trunk/source/Core/SearchFilter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/SearchFilter.cpp?rev=366489&r1=366488&r2=366489&view=diff
==============================================================================
--- lldb/trunk/source/Core/SearchFilter.cpp (original)
+++ lldb/trunk/source/Core/SearchFilter.cpp Thu Jul 18 13:19:24 2019
@@ -640,7 +640,7 @@ SearchFilterSP SearchFilterByModuleList:
"SFBM::CFSD: filter module item %zu not a string.", i);
return nullptr;
}
- modules.Append(FileSpec(module));
+ modules.EmplaceBack(module);
}
}
@@ -703,7 +703,7 @@ lldb::SearchFilterSP SearchFilterByModul
"SFBM::CFSD: filter module item %zu not a string.", i);
return result_sp;
}
- modules.Append(FileSpec(module));
+ modules.EmplaceBack(module);
}
}
@@ -725,7 +725,7 @@ lldb::SearchFilterSP SearchFilterByModul
"SFBM::CFSD: filter cu item %zu not a string.", i);
return nullptr;
}
- cus.Append(FileSpec(cu));
+ cus.EmplaceBack(cu);
}
return std::make_shared<SearchFilterByModuleListAndCU>(
Modified: lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=366489&r1=366488&r2=366489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp Thu Jul 18 13:19:24 2019
@@ -471,8 +471,8 @@ lldb::SearchFilterSP ItaniumABILanguageR
if (target.GetArchitecture().GetTriple().getVendor() == llvm::Triple::Apple) {
// Limit the number of modules that are searched for these breakpoints for
// Apple binaries.
- filter_modules.Append(FileSpec("libc++abi.dylib"));
- filter_modules.Append(FileSpec("libSystem.B.dylib"));
+ filter_modules.EmplaceBack("libc++abi.dylib");
+ filter_modules.EmplaceBack("libSystem.B.dylib");
}
return target.GetSearchFilterForModuleList(&filter_modules);
}
Modified: lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp?rev=366489&r1=366488&r2=366489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp Thu Jul 18 13:19:24 2019
@@ -946,10 +946,10 @@ uint32_t ObjectFilePECOFF::ParseDependen
dll_specs.GetDirectory().SetString(m_file.GetDirectory().GetCString());
if (!llvm::sys::fs::real_path(dll_specs.GetPath(), dll_fullpath))
- m_deps_filespec->Append(FileSpec(dll_fullpath));
+ m_deps_filespec->EmplaceBack(dll_fullpath);
else {
// Known DLLs or DLL not found in the object file directory.
- m_deps_filespec->Append(FileSpec(dll_name));
+ m_deps_filespec->EmplaceBack(dll_name);
}
}
return m_deps_filespec->GetSize();
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=366489&r1=366488&r2=366489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu Jul 18 13:19:24 2019
@@ -1227,7 +1227,7 @@ BreakpointSP PlatformDarwin::SetThreadCr
FileSpecList bp_modules;
for (size_t i = 0; i < llvm::array_lengthof(g_bp_modules); i++) {
const char *bp_module = g_bp_modules[i];
- bp_modules.Append(FileSpec(bp_module));
+ bp_modules.EmplaceBack(bp_module);
}
bool internal = true;
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=366489&r1=366488&r2=366489&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Jul 18 13:19:24 2019
@@ -833,7 +833,7 @@ SymbolFileDWARF::GetTypeUnitSupportFiles
auto iter_bool = m_type_unit_support_files.try_emplace(offset);
FileSpecList &list = iter_bool.first->second;
if (iter_bool.second) {
- list.Append(FileSpec());
+ list.EmplaceBack();
DWARFDebugLine::ParseSupportFiles(GetObjectFile()->GetModule(),
m_context.getOrLoadLineData(), offset,
list, &tu);
More information about the lldb-commits
mailing list