[clang] renaming (PR #188515)

Thomas Applencourt via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 08:40:26 PDT 2026


https://github.com/TApplencourt created https://github.com/llvm/llvm-project/pull/188515

Rename `get_version` to `get_clang_version` to match the `libclang.so` name[1], and be clear we doesn't return some `cindex.py` internal versioning but the `libclang.so` one. 

[1]  This match was some current API are doing for example `conf.lib.clang_getArraySize` is mapped to `get_array_size`.

--- 

We now have an inconsistency between `get_cindex_library` who return a path to `libclang.so`, and `get_clang_version` (and not `get_cindex_version`) who return the version of this lib. 

- One possibility will be to rename `get_cindex_library` to `get_clang_library`, but this is quite a big breaking change
- Another will be to rename `get_clang_version` to `get_cindex_version` but this obscure the link between `cindex_version` and the libclang.so call `getClangversion`. 

So personally, I can leave with this inconsistency. 

>From a5826a021a895e4a9ce6d47ccee9118f12545b38 Mon Sep 17 00:00:00 2001
From: tapplencourt <tapplencourt at anl.gov>
Date: Wed, 25 Mar 2026 15:27:15 +0000
Subject: [PATCH] renaming

---
 clang/bindings/python/clang/cindex.py              | 2 +-
 clang/bindings/python/tests/cindex/test_version.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index 6e8ea782df74c..b71f9ed2275e0 100644
--- a/clang/bindings/python/clang/cindex.py
+++ b/clang/bindings/python/clang/cindex.py
@@ -4650,7 +4650,7 @@ def get_cindex_library(self) -> CDLL:
 
         return library
 
-    def get_version(self):
+    def get_clang_version(self) -> str:
         """
         Returns the libclang version string used by the bindings
         """
diff --git a/clang/bindings/python/tests/cindex/test_version.py b/clang/bindings/python/tests/cindex/test_version.py
index 0540185221daa..2b25b0bd1c526 100755
--- a/clang/bindings/python/tests/cindex/test_version.py
+++ b/clang/bindings/python/tests/cindex/test_version.py
@@ -6,6 +6,6 @@
 class TestClangVersion(unittest.TestCase):
     def test_get_version_format(self):
         conf = Config()
-        version = conf.get_version()
+        version = conf.get_clang_version()
 
         self.assertRegex(version, r"^clang version \d+\.\d+\.\d+")



More information about the cfe-commits mailing list