================ @@ -269,6 +269,14 @@ def _get_instantiation(self): f = None self._data = (f, int(l.value), int(c.value), int(o.value)) return self._data + + def __le__(self, other): + if self.line < other.line: + return True + if self.line == other.line and self.column <= other.column: + return True + # when self.line > other.line + return False ---------------- DeinAlptraum wrote:
Note that this does not at all look at the location's file currently. Imo returning `False` when `self.file != other.file` would be reasonable, but we can't do that if we want to use this in `SourceRange.__contains__`: that function allows this for half-open intervals, where `end.file` is `None`. This is also consistent with the C interface's `SourceLocation::operator<=`: that also only takes into account the line and column number https://github.com/llvm/llvm-project/pull/101802 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits