[clang] [libclang/python] Add CompletionChunkKind enum and deprecate old CompletionChunk.Kind (PR #176631)
Jannick Kremer via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 20 05:05:00 PST 2026
================
@@ -3053,46 +3053,29 @@ class _CXUnsavedFile(Structure):
class CompletionChunk:
- class Kind:
- def __init__(self, name: str):
- self.name = name
-
- def __str__(self) -> str:
- return self.name
-
- def __repr__(self) -> str:
- return "<ChunkKind: %s>" % self
+ __kind_id: int
def __init__(self, completionString: CObjP, key: int):
self.cs = completionString
self.key = key
- self.__kindNumberCache = -1
+ self.__kind_id = conf.lib.clang_getCompletionChunkKind(
+ self.cs, self.key
+ )
----------------
DeinAlptraum wrote:
Since `CompletionChunk` does not directly correspond to a C++ type, it doesn't already have a `_kind_id` attribute to hold its associated kind like e.g. `Cursor` and `Type` do, so I've added a `__kind_id` attribute manunally here. To do away with the "is it set or is it not set" logic, I've decided to implement this such that the kind is determined immediately on initialization of the `CompletionChunk`.
https://github.com/llvm/llvm-project/pull/176631
More information about the cfe-commits
mailing list