[cfe-commits] r164464 - /cfe/trunk/bindings/python/clang/cindex.py
Dmitri Gribenko
gribozavr at gmail.com
Sat Sep 22 10:52:29 PDT 2012
Author: gribozavr
Date: Sat Sep 22 12:52:29 2012
New Revision: 164464
URL: http://llvm.org/viewvc/llvm-project?rev=164464&view=rev
Log:
Fix cindex.py compatibility with older libclang.so
The issue is that we were calling clang_getCompletionBriefComment
unconditionally. New we check if this function is available before calling it.
Modified:
cfe/trunk/bindings/python/clang/cindex.py
Modified: cfe/trunk/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/bindings/python/clang/cindex.py?rev=164464&r1=164463&r2=164464&view=diff
==============================================================================
--- cfe/trunk/bindings/python/clang/cindex.py (original)
+++ cfe/trunk/bindings/python/clang/cindex.py Sat Sep 22 12:52:29 2012
@@ -1737,7 +1737,9 @@
@property
def briefComment(self):
- return conf.lib.clang_getCompletionBriefComment(self.obj)
+ if conf.function_exists("clang_getCompletionBriefComment"):
+ return conf.lib.clang_getCompletionBriefComment(self.obj)
+ return _CXString()
def __repr__(self):
return " | ".join([str(a) for a in self]) \
@@ -3097,6 +3099,13 @@
return library
+ def function_exists(self, name):
+ try:
+ getattr(self.lib, name)
+ except AttributeError:
+ return False
+
+ return True
def register_enumerations():
for name, value in clang.enumerations.TokenKinds:
More information about the cfe-commits
mailing list