This patch allows libclang to report a parser crash that's caused by #pragma clang __debug parser_crash without using the LLVM_BUILTIN_TRAP. Instead a new flag in PPOpts is used to let libclang know that a simulated crash has occurred. This flag allows clients to test that libclang can report a parser crash (CXError_Crash) when libclang is ran under a debugger that breaks on LLVM_BUILTIN_TRAP.
Did you consider just using a different pragma that triggers this behaviour instead of avoiding the crash? I don't really have a strong preference but I'd be interested to hear what you think the pros/cons are.
This should return immediately (and keep exiting until ~ParseAST) or it won't really behave like a trap.