[clang] [libclang/python] Fix bug in `SourceRange.__contains__`, add tests (PR #101802)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 10:16:38 PDT 2024


================
@@ -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:

I've exposed a `clang_lessThanLocations` function on C-side, similar to the `clang_equalLocations` function, and used this to implement the operators on Python side. Hope that resolves this case.

https://github.com/llvm/llvm-project/pull/101802


More information about the cfe-commits mailing list