mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-22 23:24:59 +00:00
Prefer SmallVector::append/insert over push_back loops.
Same functionality, but hoists the vector growth out of the loop. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229500 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -333,8 +333,8 @@ public:
|
||||
std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() const {
|
||||
std::vector<StringRef> Filenames;
|
||||
for (const auto &Function : getCoveredFunctions())
|
||||
for (const auto &Filename : Function.Filenames)
|
||||
Filenames.push_back(Filename);
|
||||
Filenames.insert(Filenames.end(), Function.Filenames.begin(),
|
||||
Function.Filenames.end());
|
||||
std::sort(Filenames.begin(), Filenames.end());
|
||||
auto Last = std::unique(Filenames.begin(), Filenames.end());
|
||||
Filenames.erase(Last, Filenames.end());
|
||||
@@ -425,8 +425,8 @@ CoverageMapping::getInstantiations(StringRef Filename) {
|
||||
for (const auto &InstantiationSet : InstantiationSetCollector) {
|
||||
if (InstantiationSet.second.size() < 2)
|
||||
continue;
|
||||
for (auto Function : InstantiationSet.second)
|
||||
Result.push_back(Function);
|
||||
Result.insert(Result.end(), InstantiationSet.second.begin(),
|
||||
InstantiationSet.second.end());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user