================ @@ -386,6 +386,10 @@ def __contains__(self, other): # same file, in between lines if self.start.line < other.line < self.end.line: return True + # between columns in one-liner range + elif self.start.line == other.line == self.end.line: ---------------- DeinAlptraum wrote:
Okay, that was my mistake: when testing this, I created two separate TUs for the two files, and _that_ is apparently where it's sensitive. So no issue on the C-side here after al. Going back to the Python bindings: we are now left with a pre-existing `SourceLocation.__eq__` that _is_ file-sensitive, and in order to have a clean implementation, we would like a `SourceLocation.__le__` / `SourceLOcation.__lt__` that is _not_ file-sensitive, so it can be used for `SourceRange.__contains__`. Exposing something like this would be ugly due to inconsistency. So I guess it would be the easiest to implement such an `operator<=` function just locally inside `SourceRange.__contains__` to simplify the logic there, and not expose any new functionality at all. What do you think? 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