File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
lib/AST/RequirementMachine Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,15 @@ bool Rule::isProtocolRefinementRule() const {
7373 LHS[0 ] != LHS[1 ]);
7474}
7575
76+ // / Linear order on rules; compares LHS followed by RHS.
77+ int Rule::compare (const Rule &other, const ProtocolGraph &protos) const {
78+ int compare = LHS.compare (other.LHS , protos);
79+ if (compare != 0 )
80+ return compare;
81+
82+ return RHS.compare (other.RHS , protos);
83+ }
84+
7685void Rule::dump (llvm::raw_ostream &out) const {
7786 out << LHS << " => " << RHS;
7887 if (Permanent)
Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ class Rule final {
122122 return LHS.size ();
123123 }
124124
125+ int compare (const Rule &other, const ProtocolGraph &protos) const ;
126+
125127 void dump (llvm::raw_ostream &out) const ;
126128
127129 friend llvm::raw_ostream &operator <<(llvm::raw_ostream &out,
You can’t perform that action at this time.
0 commit comments