[Lldb-commits] [lldb] [lldb][windows] refactor the version check in @skipIfWindows (PR #172838)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 18 07:47:50 PST 2025


================
@@ -322,8 +342,34 @@ def getDwarfVersion():
     return "0"
 
 
+def isExpectedVersion(
+    actual_version: str, required_version: str, operator: str
+) -> bool:
+    """Returns True if actual_version matches the required_version given the operator.
+    Any operator other than the following defaults to an equality test:
+        '>', '>=', "=>", '<', '<=', '=<', '!=', "!" or 'not'
+
+    Example:
+      - actual_version='1.2.0', required_version='1.0.0', operator='>=' returns True
+    """
+    actual_version_ = version.parse(actual_version)
+    required_version_ = version.parse(required_version)
+
+    if operator == ">":
+        return actual_version_ > required_version_
+    if operator == ">=" or operator == "=>":
+        return actual_version_ >= required_version_
+    if operator == "<":
+        return actual_version_ < required_version_
+    if operator == "<=" or operator == "=<":
+        return actual_version_ <= required_version_
+    if operator == "!=" or operator == "!" or operator == "not":
+        return actual_version not in required_version
+    return actual_version in required_version
+
+
 def expectedCompilerVersion(compiler_version):
-    """Returns True iff compiler_version[1] matches the current compiler version.
+    """Returns True if compiler_version[1] matches the current compiler version.
----------------
charles-zablit wrote:

I thought it was a typo, I reverted it :)

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


More information about the lldb-commits mailing list