diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 0625b4c3a376f..0f6d2919b3795 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -3081,32 +3081,6 @@ def __getattribute__(self, attr): class CompletionChunk: - class SpellingCacheAlias: - """ - A temporary utility that acts as an alias to CompletionChunk.SPELLING_CACHE. - This will be removed without deprecation warning in a future release. - Please do not use it directly! - """ - - deprecation_message = ( - "'SPELLING_CACHE' has been moved into the scope of 'CompletionChunk' " - "and adapted to use 'CompletionChunkKind's as keys instead of their " - "enum values. Please adapt all uses of 'SPELLING_CACHE' to use " - "'CompletionChunk.SPELLING_CACHE' instead. The old 'SPELLING_CACHE' " - "will be removed in a future release." - ) - - def __getattr__(self, _: Any) -> NoReturn: - raise AttributeError(self.deprecation_message) - - def __getitem__(self, value: int) -> str: - warnings.warn(self.deprecation_message, DeprecationWarning) - return CompletionChunk.SPELLING_CACHE[CompletionChunkKind.from_id(value)] - - def __contains__(self, value: int) -> bool: - warnings.warn(self.deprecation_message, DeprecationWarning) - return CompletionChunkKind.from_id(value) in CompletionChunk.SPELLING_CACHE - # Functions calls through the python interface are rather slow. Fortunately, # for most symbols, we do not need to perform a function call. Their spelling # never changes and is consequently provided by this spelling cache. @@ -3165,9 +3139,6 @@ def string(self) -> CompletionString | None: return CompletionString(res) -SPELLING_CACHE = CompletionChunk.SpellingCacheAlias() - - class CompletionString(ClangObject): # AvailabilityKindCompat is an exact copy of AvailabilityKind, except for __str__. # This is a temporary measure to keep the string representation the same diff --git a/clang/bindings/python/tests/cindex/test_code_completion.py b/clang/bindings/python/tests/cindex/test_code_completion.py index 5be03fab36db8..abc5d3d23c982 100644 --- a/clang/bindings/python/tests/cindex/test_code_completion.py +++ b/clang/bindings/python/tests/cindex/test_code_completion.py @@ -3,7 +3,6 @@ CompletionChunk, CompletionChunkKind, CompletionString, - SPELLING_CACHE, TranslationUnit, ) @@ -198,27 +197,3 @@ def test_compat_str(self): self.assertEqual(str(kind), string) self.assertEqual(len(log), 1) self.assertIsInstance(log[0].message, DeprecationWarning) - - def test_spelling_cache_missing_attribute(self): - # Test that accessing missing attributes on SpellingCacheAlias raises - # during the transitionary period - with self.assertRaises(AttributeError, msg=SPELLING_CACHE.deprecation_message): - SPELLING_CACHE.keys() - - def test_spelling_cache_alias(self): - kind_keys = list(CompletionChunk.SPELLING_CACHE) - self.assertEqual(len(kind_keys), 13) - for kind_key in kind_keys: - with warnings.catch_warnings(record=True) as log: - self.assertEqual( - SPELLING_CACHE[kind_key.value], - CompletionChunk.SPELLING_CACHE[kind_key], - ) - self.assertEqual(len(log), 1) - self.assertIsInstance(log[0].message, DeprecationWarning) - - def test_spelling_cache_missing_attribute(self): - # Test that accessing missing attributes on SpellingCacheAlias raises - # during the transitionary period - with self.assertRaises(AttributeError, msg=SPELLING_CACHE.deprecation_message): - SPELLING_CACHE.keys() diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index 08397eae28557..9ac0628a30425 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -73,6 +73,10 @@ features cannot lower the translation-unit ABI level; - `CompletionChunkKind` instance's `__str__` representation has been adapted to be consistent with other enums in the library. The representation now follows the `CompletionChunkKind.VARIANT_NAME` scheme instead of `VariantName`. +- Remove the deprecated `SPELLING_CACHE` alias. + All usage should be migrated to use `CompletionChunk.SPELLING_CACHE` instead. + Note that this uses `CompletionChunkKind` enumeration as keys, instead of integer values. + - Remove the deprecated `CompletionChunk.isKind...` methods. Existing uses should be adapted to directly compare equality of the `CompletionChunk` kind with the corresponding `CompletionChunkKind` variant.