I am using libclang in Python to construct the AST of some source code. It occurs segmentation fault(core dumped) error for few files. Then I try the command in terminal clang -fmodules -fsyntax-only -Xclang -ast-dump + file. The error occurs, too. I believe clang crashed. (I do not know why, If you know how to solve it, please tell me). Because only few files cause this error. I want to ignore them and use try...except statement in python, but this statement does not work, this error still occurs and code running interrupts directly instead of running code in except. How can I delete the source file which causes error and continue to construct the AST for other files?
segmentation fault (core dumped) means that the python interpreter has completely stopped (because of a bug in libclang probably).  try...except will not catch this.
Your best bet is to create a bug report for libclang, and attach a file which causes the error.
The only other options is to run libclang in a separate process for each file, and ignore any results if the process terminates.
Python & clang: try...except statement not working for segmentation fault(core dumped)