mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 16:17:17 +00:00
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:
@@ -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();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user