From 90fee07298bec2e5160a599db850b9553d02377b Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Wed, 19 Sep 2012 01:47:00 +0000 Subject: 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 --- include/llvm/TableGen/Record.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/llvm/TableGen') 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. /// -- cgit v1.1