diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-22 17:52:29 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-22 17:52:29 +0000 |
commit | c12d6a027662c978fc418c6fb584222fb3638483 (patch) | |
tree | 3a9f292ccafd45c89cc94d72a6db338d1e7ce564 /bindings | |
parent | 0d8ecf3a455a77027c55b050a63bec7ee842c1b5 (diff) | |
download | clang-c12d6a027662c978fc418c6fb584222fb3638483.tar.gz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164464 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/python/clang/cindex.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index 770ff0e0fe..edd3e707f7 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1737,7 +1737,9 @@ class CompletionString(ClangObject): @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 @@ class Config: 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: |