https://github.com/DeinAlptraum created https://github.com/llvm/llvm-project/pull/177854
This adresses point 3 from https://github.com/llvm/llvm-project/issues/156680. >From 6539a03fc79ec91f39427aaf8268763ec95073d5 Mon Sep 17 00:00:00 2001 From: Jannick Kremer <[email protected]> Date: Sun, 25 Jan 2026 22:30:58 +0900 Subject: [PATCH] Add deprecation warnings to CompletionChunk.is... methods --- clang/bindings/python/clang/cindex.py | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 6d667c36ef9a4..2120613269ca8 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -3157,19 +3157,55 @@ def string(self) -> CompletionString | None: return None return CompletionString(res) + __deprecation_message = ( + "'CompletionChunk.{}' will be removed in a future release. " + "All uses of 'CompletionChunk.{}' should be replaced by checking " + "if the 'CompletionChunk's kind is 'CompletionChunkKind.{}'." + ) + def isKindOptional(self) -> bool: + deprecation_message = self.__deprecation_message.format( + "isKindOptional", + "isKindOptional", + "OPTIONAL", + ) + warnings.warn(deprecation_message, DeprecationWarning) return self.kind == CompletionChunkKind.OPTIONAL def isKindTypedText(self) -> bool: + deprecation_message = self.__deprecation_message.format( + "isKindTypedText", + "isKindTypedText", + "TYPED_TEXT", + ) + warnings.warn(deprecation_message, DeprecationWarning) return self.kind == CompletionChunkKind.TYPED_TEXT def isKindPlaceHolder(self) -> bool: + deprecation_message = self.__deprecation_message.format( + "isKindPlaceHolder", + "isKindPlaceHolder", + "PLACEHOLDER", + ) + warnings.warn(deprecation_message, DeprecationWarning) return self.kind == CompletionChunkKind.PLACEHOLDER def isKindInformative(self) -> bool: + deprecation_message = self.__deprecation_message.format( + "isKindInformative", + "isKindInformative", + "INFORMATIVE", + ) + warnings.warn(deprecation_message, DeprecationWarning) return self.kind == CompletionChunkKind.INFORMATIVE def isKindResultType(self) -> bool: + deprecation_message = self.__deprecation_message.format( + "isKindResultType", + "isKindResultType", + "RESULT_TYPE", + ) + warnings.warn(deprecation_message, DeprecationWarning) return self.kind == CompletionChunkKind.RESULT_TYPE _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
