Author: Thomas Applencourt Date: 2025-12-20T00:09:00+04:00 New Revision: 3fd31924c52e8cd341c231769aa2c97e06c4963c
URL: https://github.com/llvm/llvm-project/commit/3fd31924c52e8cd341c231769aa2c97e06c4963c DIFF: https://github.com/llvm/llvm-project/commit/3fd31924c52e8cd341c231769aa2c97e06c4963c.diff LOG: [libclang/python] Add check for reparsing (#172373) Add error checking for `reparseTranslationUnit`. Added: Modified: clang/bindings/python/clang/cindex.py Removed: ################################################################################ diff --git a/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py index 1e17627249dda..2b6ab00c88219 100644 --- a/clang/bindings/python/clang/cindex.py +++ b/clang/bindings/python/clang/cindex.py @@ -3598,9 +3598,14 @@ def reparse(self, unsaved_files=None, options=0): unsaved_files = [] unsaved_files_array = self.process_unsaved_files(unsaved_files) - ptr = conf.lib.clang_reparseTranslationUnit( - self, len(unsaved_files), unsaved_files_array, options + result = int( + conf.lib.clang_reparseTranslationUnit( + self, len(unsaved_files), unsaved_files_array, options + ) ) + if result != 0: + msg = "Error reparsing translation unit. Error code: " + str(result) + raise TranslationUnitLoadError(msg) def save(self, filename): """Saves the TranslationUnit to a file. _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
