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 {
73
73
LHS[0 ] != LHS[1 ]);
74
74
}
75
75
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
+
76
85
void Rule::dump (llvm::raw_ostream &out) const {
77
86
out << LHS << " => " << RHS;
78
87
if (Permanent)
Original file line number Diff line number Diff line change @@ -122,6 +122,8 @@ class Rule final {
122
122
return LHS.size ();
123
123
}
124
124
125
+ int compare (const Rule &other, const ProtocolGraph &protos) const ;
126
+
125
127
void dump (llvm::raw_ostream &out) const ;
126
128
127
129
friend llvm::raw_ostream &operator <<(llvm::raw_ostream &out,
You can’t perform that action at this time.
0 commit comments