[clang] #101784 part 2: fix error handling of TranslationUnit.reparse (PR #102410)

Jannick Kremer via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 07:00:28 PDT 2024


================
@@ -152,6 +152,41 @@ def b(x: str | bytes) -> bytes:
 ### Exception Classes ###
 
 
+class CXError(Exception):
----------------
DeinAlptraum wrote:

We already have a similar case with the bindings' `CXSaveError` for `clang_saveTranslationUnit` on the C side, for which we've implemented the `TranslationUnitSaveError` exception on Python side.
On the C side, we also have `CXErrorCode` for `clang_parseTranslationUnit`, `clang_reparseTranslationUnit` and `clang_createTranslationUnit`. Mirroring the `clang_saveTranslationUnit` call, there's already the `TranslationUnitLoadError` error for those 3 functions

I would thus suggest adding this to the `TranslationUnitLoadError`, rather than making a new exception for this

https://github.com/llvm/llvm-project/pull/102410


More information about the cfe-commits mailing list