[clang] [libclang/python] export libclang version to the bindings (PR #86931)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 28 03:12:38 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (efferre79)

<details>
<summary>Changes</summary>

it's useful to know which clang library the python byndings are running

---
Full diff: https://github.com/llvm/llvm-project/pull/86931.diff


1 Files Affected:

- (modified) clang/bindings/python/clang/cindex.py (+4) 


``````````diff
diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index 302d99dccd77b5..a98fa9ee70569d 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -3846,6 +3846,7 @@ def write_main_file_to_stdout(self):
     ("clang_getCanonicalCursor", [Cursor], Cursor, Cursor.from_cursor_result),
     ("clang_getCanonicalType", [Type], Type, Type.from_result),
     ("clang_getChildDiagnostics", [Diagnostic], c_object_p),
+    ("clang_getClangVersion", [], _CXString, _CXString.from_result),
     ("clang_getCompletionAvailability", [c_void_p], c_int),
     ("clang_getCompletionBriefComment", [c_void_p], _CXString, _CXString.from_result),
     ("clang_getCompletionChunkCompletionString", [c_void_p, c_int], c_object_p),
@@ -4178,6 +4179,9 @@ def function_exists(self, name):
             return False
 
         return True
+ 
+    def get_version(self):
+        return self.lib.clang_getClangVersion()
 
 
 def register_enumerations():

``````````

</details>


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


More information about the cfe-commits mailing list