[PATCH] D18478: python bindings: expose the clang version string

John Törnblom via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 25 12:23:40 PDT 2016


john.tornblom created this revision.
john.tornblom added reviewers: eliben, compnerd.
john.tornblom added a subscriber: cfe-commits.

http://reviews.llvm.org/D18478

Files:
  bindings/python/clang/cindex.py

Index: bindings/python/clang/cindex.py
===================================================================
--- bindings/python/clang/cindex.py
+++ bindings/python/clang/cindex.py
@@ -3007,6 +3007,9 @@
    Type,
    Type.from_result),
 
+  ("clang_getClangVersion",
+   [], _CXString),
+    
   ("clang_getCompletionAvailability",
    [c_void_p],
    c_int),
@@ -3625,6 +3628,16 @@
 
         return True
 
+    @property
+    def version_string(self):
+        """Return a version string, suitable for showing to a user
+
+        The version string is not intended to be parsed, and the format is not
+        guaranteed to be stable.
+        """
+        version = self.lib.clang_getClangVersion()
+        return version.spelling
+
 def register_enumerations():
     for name, value in clang.enumerations.TokenKinds:
         TokenKind.register(value, name)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18478.51669.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160325/cd1f1a07/attachment.bin>


More information about the cfe-commits mailing list