Now that we have C++11, turn simple functors into lambdas and remove a ton of boilerplate.

No intended functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202588 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Benjamin Kramer
2014-03-01 11:47:00 +00:00
parent 73bbab9d75
commit ee5e607355
20 changed files with 114 additions and 312 deletions

View File

@ -239,14 +239,6 @@ namespace {
};
// Sorting function for deterministic behaviour in GCOVBlock::writeOut.
struct StringKeySort {
bool operator()(StringMapEntry<GCOVLines *> *LHS,
StringMapEntry<GCOVLines *> *RHS) const {
return LHS->getKey() < RHS->getKey();
}
};
// Represent a basic block in GCOV. Each block has a unique number in the
// function, number of lines belonging to each block, and a set of edges to
// other blocks.
@ -277,8 +269,11 @@ namespace {
write(Len);
write(Number);
StringKeySort Sorter;
std::sort(SortedLinesByFile.begin(), SortedLinesByFile.end(), Sorter);
std::sort(SortedLinesByFile.begin(), SortedLinesByFile.end(),
[](StringMapEntry<GCOVLines *> *LHS,
StringMapEntry<GCOVLines *> *RHS) {
return LHS->getKey() < RHS->getKey();
});
for (SmallVectorImpl<StringMapEntry<GCOVLines *> *>::iterator
I = SortedLinesByFile.begin(), E = SortedLinesByFile.end();
I != E; ++I)