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

@@ -289,17 +289,6 @@ GetInstByName(const char *Name,
return I->second;
}
namespace {
/// SortInstByName - Sorting predicate to sort instructions by name.
///
struct SortInstByName {
bool operator()(const CodeGenInstruction *Rec1,
const CodeGenInstruction *Rec2) const {
return Rec1->TheDef->getName() < Rec2->TheDef->getName();
}
};
}
/// \brief Return all of the instructions defined by the target, ordered by
/// their enum value.
void CodeGenTarget::ComputeInstrsByEnum() const {
@@ -346,8 +335,10 @@ void CodeGenTarget::ComputeInstrsByEnum() const {
// All of the instructions are now in random order based on the map iteration.
// Sort them by name.
std::sort(InstrsByEnum.begin()+EndOfPredefines, InstrsByEnum.end(),
SortInstByName());
std::sort(InstrsByEnum.begin() + EndOfPredefines, InstrsByEnum.end(),
[](const CodeGenInstruction *Rec1, const CodeGenInstruction *Rec2) {
return Rec1->TheDef->getName() < Rec2->TheDef->getName();
});
}