diff options
author | Sean Silva <silvas@purdue.edu> | 2012-09-19 01:47:00 +0000 |
---|---|---|
committer | Sean Silva <silvas@purdue.edu> | 2012-09-19 01:47:00 +0000 |
commit | 90fee07298bec2e5160a599db850b9553d02377b (patch) | |
tree | fe79cf6b5aa89ed8aa97790491abdb8c283f5db6 /include/llvm/TableGen | |
parent | 2811ae66a857691b47fbcf98a12521380c05aad0 (diff) | |
download | external_llvm-90fee07298bec2e5160a599db850b9553d02377b.zip external_llvm-90fee07298bec2e5160a599db850b9553d02377b.tar.gz external_llvm-90fee07298bec2e5160a599db850b9553d02377b.tar.bz2 |
Refactor Record* by-ID comparator to Record.h
This is a generally useful utility; there's no reason to have it hidden
in CodeGenDAGPatterns.cpp.
Also, rename it to fit the other comparators in Record.h
Review by Jakob.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/TableGen')
-rw-r--r-- | include/llvm/TableGen/Record.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/TableGen/Record.h b/include/llvm/TableGen/Record.h index 66d6dbd..032f153 100644 --- a/include/llvm/TableGen/Record.h +++ b/include/llvm/TableGen/Record.h @@ -1609,6 +1609,16 @@ struct LessRecord { } }; +/// LessRecordByID - Sorting predicate to sort record pointers by their +/// unique ID. If you just need a deterministic order, use this, since it +/// just compares two `unsigned`; the other sorting predicates require +/// string manipulation. +struct LessRecordByID { + bool operator()(const Record *LHS, const Record *RHS) const { + return LHS->getID() < RHS->getID(); + } +}; + /// LessRecordFieldName - Sorting predicate to sort record pointers by their /// name field. /// |