================
@@ -3598,9 +3598,13 @@ 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:
+ raise TranslationUnitLoadError("Error reparsing translation unit.")
----------------
Endilll wrote:
I agree with Jannick that generic error message is not too helpful, and it also
falls short of diagnostic
[guidelines](https://clang.llvm.org/docs/InternalsManual.html#id11), which were
not necessarily written with libclang in mind, but still worth aspiring.
This PR, like many others, would benefit from holistic design of error handling
in Python bindings, but I haven't seen it through (I'd like to add "yet", but
that'd be optimistic). For now I'd like us not to add to the mess.
> Or just do str(e) + "Error reparsing translation unit."?
I'd prefer it in a slightly different form: `"Error reparsing translation unit:
\n" + str(e)`.
https://github.com/llvm/llvm-project/pull/172373
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits