diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2013-01-19 11:03:40 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2013-01-19 11:03:40 +0000 |
commit | e43d3861d969ad583e10ef7e46c5e08e866dfaa5 (patch) | |
tree | 5e8ca8a9aa8f7d40c8bd17614cb2b7cabacd4c0c /bindings | |
parent | b1ba0efc3d1dc1daa5d82c40bc504e1f368c4fa0 (diff) |
[cindex.py]: Speed up lookup of the completion kind
We can directly the number of the kind instead of going through the
completionChunkKindMap.
Formatting time changes from 0.84 to 0.72 seconds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/python/clang/cindex.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/bindings/python/clang/cindex.py b/bindings/python/clang/cindex.py index 581f5e6fef..474e10b434 100644 --- a/bindings/python/clang/cindex.py +++ b/bindings/python/clang/cindex.py @@ -1668,9 +1668,13 @@ class CompletionChunk: return conf.lib.clang_getCompletionChunkText(self.cs, self.key).spelling @CachedProperty - def kind(self): + def __kindNumber(self): res = conf.lib.clang_getCompletionChunkKind(self.cs, self.key) - return completionChunkKindMap[res] + return res + + @CachedProperty + def kind(self): + return completionChunkKindMap[self.__kindNumber] @CachedProperty def string(self): @@ -1683,19 +1687,19 @@ class CompletionChunk: None def isKindOptional(self): - return self.kind == completionChunkKindMap[0] + return self.__kindNumber == 0 def isKindTypedText(self): - return self.kind == completionChunkKindMap[1] + return self.__kindNumber == 1 def isKindPlaceHolder(self): - return self.kind == completionChunkKindMap[3] + return self.__kindNumber == 3 def isKindInformative(self): - return self.kind == completionChunkKindMap[4] + return self.__kindNumber == 4 def isKindResultType(self): - return self.kind == completionChunkKindMap[15] + return self.__kindNumber == 15 completionChunkKindMap = { 0: CompletionChunk.Kind("Optional"), |